2
0
forked from Wavyzz/dolibarr

Fix: avoid warning php strict mode

This commit is contained in:
Regis Houssin
2012-07-10 11:45:38 +02:00
parent 41789458c5
commit 41144643eb
6 changed files with 139 additions and 124 deletions

View File

@@ -30,10 +30,16 @@ $langs->load("admin");
if (! $user->admin) accessforbidden();
$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")."<br>\n";
print "<br>\n";
if ($mesg) print $mesg;
dol_htmloutput_mesg($mesg);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';

View File

@@ -2,7 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
@@ -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 '<td>';
if (preg_match('/http:/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.'</a>';
if (! empty($tabhelp[$id][$value]) && preg_match('/http:/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.'</a>';
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
else print $valuetoshow;
print '</td>';
@@ -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 "<tr ".$bc[$var].">";
if ($action == 'edit' && ($rowid == ($obj->rowid?$obj->rowid:$obj->code)))
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
{
print '<form action="dict.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@@ -810,7 +810,7 @@ if ($id)
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id]);
print '<td colspan="3" align="right"><a name="'.($obj->rowid?$obj->rowid:$obj->code).'">&nbsp;</a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<td colspan="3" align="right"><a name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'">&nbsp;</a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '&nbsp;<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
}
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 '<a href="'.$_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.($obj->rowid?$obj->rowid:$obj->code).'&amp;code='.$obj->code.'&amp;id='.$id.'&amp;action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
if ($iserasable) print '<a href="'.$_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&amp;code='.(! empty($obj->code)?$obj->code:'').'&amp;id='.$id.'&amp;action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
else print $langs->trans("AlwaysActive");
print "</td>";
// Modify link
if ($iserasable) print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.($obj->rowid?$obj->rowid:$obj->code).'&amp;code='.$obj->code.'&amp;id='.$id.'&amp;action=edit#'.($obj->rowid?$obj->rowid:$obj->code).'">'.img_edit().'</a></td>';
if ($iserasable) print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&amp;code='.(! empty($obj->code)?$obj->code:'').'&amp;id='.$id.'&amp;action=edit#'.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>';
// Delete link
if ($iserasable) print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.($obj->rowid?$obj->rowid:$obj->code).'&amp;code='.$obj->code.'&amp;id='.$id.'&amp;action=delete">'.img_delete().'</a></td>';
if ($iserasable) print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&amp;code='.(! empty($obj->code)?$obj->code:'').'&amp;id='.$id.'&amp;action=delete">'.img_delete().'</a></td>';
else print '<td>&nbsp;</td>';
print "</tr>\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 '<br>';
$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 '<td>&nbsp;</td>'; continue; } // For region page, we do not show the country input
print '<td>';
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 '</td>';
}
elseif ($fieldlist[$field] == 'pays_id') {
@@ -1052,7 +1052,7 @@ function fieldList($fieldlist,$obj='',$tabname='')
print '</td>';
}
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 '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
}
elseif ($fieldlist[$field] == 'lang') {
@@ -1064,14 +1064,14 @@ function fieldList($fieldlist,$obj='',$tabname='')
elseif ($fieldlist[$field] == 'element')
{
print '<td>';
print $form->selectarray('element', $elementList,$obj->$fieldlist[$field]);
print $form->selectarray('element', $elementList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
print '</td>';
}
// La source de l'element (pour les type de contact).'
elseif ($fieldlist[$field] == 'source')
{
print '<td>';
print $form->selectarray('source', $sourceList,$obj->$fieldlist[$field]);
print $form->selectarray('source', $sourceList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
print '</td>';
}
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 '<td>';
print $form->selectyesno($fieldlist[$field],$obj->$fieldlist[$field],1);
print $form->selectyesno($fieldlist[$field],(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''),1);
print '</td>';
}
elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) {
print '<td><input type="text" class="flat" value="'.$obj->$fieldlist[$field].'" size="3" name="'.$fieldlist[$field].'"></td>';
print '<td><input type="text" class="flat" value="'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" size="3" name="'.$fieldlist[$field].'"></td>';
}
elseif ($fieldlist[$field] == 'libelle_facture') {
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.$obj->$fieldlist[$field].'</textarea></td>';
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'</textarea></td>';
}
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
print '<td><input type="text" class="flat" value="'.price($obj->$fieldlist[$field]).'" size="8" name="'.$fieldlist[$field].'"></td>';
print '<td><input type="text" class="flat" value="'.price((! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'')).'" size="8" name="'.$fieldlist[$field].'"></td>';
}
elseif ($fieldlist[$field] == 'code') {
print '<td><input type="text" class="flat" value="'.$obj->$fieldlist[$field].'" size="10" name="'.$fieldlist[$field].'"></td>';
elseif ($fieldlist[$field] == 'code' && isset($obj->$fieldlist[$field])) {
print '<td><input type="text" class="flat" value="'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
}
elseif ($fieldlist[$field]=='unit') {
print '<td>';
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 '</td>';
}
else
{
print '<td>';
print '<input type="text" '.($fieldlist[$field]=='libelle'?'size="32" ':'').' class="flat" value="'.$obj->$fieldlist[$field].'" name="'.$fieldlist[$field].'">';
print '<input type="text" '.($fieldlist[$field]=='libelle'?'size="32" ':'').' class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" name="'.$fieldlist[$field].'">';
print '</td>';
}
}

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2009-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
@@ -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 '</td><td>';
// SuperAdministrator access only
if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity))
if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity))
{
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="' . $conf->global->MAIN_MAIL_SMTP_SERVER . '">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_sav" value="' . $conf->global->MAIN_MAIL_SMTP_SERVER . '">';
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="' . $mainserver . '">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_sav" value="' . $mainserver . '">';
}
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 '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" value="'.$conf->global->MAIN_MAIL_SMTP_SERVER.'">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" value="'.$mainserver.'">';
}
}
print '</td></tr>';
@@ -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 '</td><td>';
// SuperAdministrator access only
if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity))
if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity))
{
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" size="3" value="' . $conf->global->MAIN_MAIL_SMTP_PORT . '">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_sav" name="MAIN_MAIL_SMTP_PORT_sav" value="' . $conf->global->MAIN_MAIL_SMTP_PORT . '">';
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" size="3" value="' . $mainport . '">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_sav" name="MAIN_MAIL_SMTP_PORT_sav" value="' . $mainport . '">';
}
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 '<input type="hidden" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" value="'.$conf->global->MAIN_MAIL_SMTP_PORT.'">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" value="'.$mainport.'">';
}
}
print '</td></tr>';
// 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 '<tr '.$bcdd[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>';
// SuperAdministrator access only
if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity))
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{
print '<input class="flat" name="MAIN_MAIL_SMTPS_ID" size="32" value="' . $conf->global->MAIN_MAIL_SMTPS_ID . '">';
print '<input class="flat" name="MAIN_MAIL_SMTPS_ID" size="32" value="' . $mainstmpid . '">';
}
else
{
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID,$htmltext,1,'superadmin');
print '<input type="hidden" name="MAIN_MAIL_SMTPS_ID" value="'.$conf->global->MAIN_MAIL_SMTPS_ID.'">';
print '<input type="hidden" name="MAIN_MAIL_SMTPS_ID" value="'.$mainstmpid.'">';
}
print '</td></tr>';
}
// 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 '<tr '.$bcdd[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>';
// SuperAdministrator access only
if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity))
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{
print '<input class="flat" name="MAIN_MAIL_SMTPS_PW" size="32" value="' . $conf->global->MAIN_MAIL_SMTPS_PW . '">';
print '<input class="flat" name="MAIN_MAIL_SMTPS_PW" size="32" value="' . $mainsmtppw . '">';
}
else
{
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW,$htmltext,1,'superadmin');
print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW" value="'.$conf->global->MAIN_MAIL_SMTPS_PW.'">';
print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW" value="'.$mainsmtppw.'">';
}
print '</td></tr>';
}
@@ -470,11 +475,11 @@ if ($action == 'edit')
// TLS
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
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 '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td>';
print '<td><input class="flat" name="MAIN_MAIL_EMAIL_FROM" size="32" value="' . $conf->global->MAIN_MAIL_EMAIL_FROM;
print '<td><input class="flat" name="MAIN_MAIL_EMAIL_FROM" size="32" value="' . (! empty($conf->global->MAIN_MAIL_EMAIL_FROM)?$conf->global->MAIN_MAIL_EMAIL_FROM:'');
print '"></td></tr>';
// From
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
print '<td><input class="flat" name="MAIN_MAIL_ERRORS_TO" size="32" value="' . $conf->global->MAIN_MAIL_ERRORS_TO;
print '<td><input class="flat" name="MAIN_MAIL_ERRORS_TO" size="32" value="' . (! empty($conf->global->MAIN_MAIL_ERRORS_TO)?$conf->global->MAIN_MAIL_ERRORS_TO:'');
print '"></td></tr>';
// Autocopy to
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
print '<td><input class="flat" name="MAIN_MAIL_AUTOCOPY_TO" size="32" value="' . $conf->global->MAIN_MAIL_AUTOCOPY_TO;
print '<td><input class="flat" name="MAIN_MAIL_AUTOCOPY_TO" size="32" value="' . (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)?$conf->global->MAIN_MAIL_AUTOCOPY_TO:'');
print '"></td></tr>';
print '</table>';
@@ -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 '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
}
else
{
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER",ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined")).'</td><td>'.$conf->global->MAIN_MAIL_SMTP_SERVER.'</td></tr>';
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER",ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined")).'</td><td>'.(! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:'').'</td></tr>';
}
// 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 '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
}
else
{
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT",ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined")).'</td><td>'.$conf->global->MAIN_MAIL_SMTP_PORT.'</td></tr>';
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT",ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined")).'</td><td>'.(! empty($conf->global->MAIN_MAIL_SMTP_PORT)?$conf->global->MAIN_MAIL_SMTP_PORT:'').'</td></tr>';
}
// 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 '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_ID.'</td></tr>';
}
// 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 '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./','*',$conf->global->MAIN_MAIL_SMTPS_PW).'</td></tr>';
}
@@ -575,7 +580,7 @@ else
// TLS
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
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'))
{
@@ -607,8 +612,16 @@ else
// Autocopy to
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
print '<td>'.$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 '<td>';
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 '&nbsp;';
}
print '</td></tr>';
print '</table>';

View File

@@ -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 '</td></tr>';
print '</table>';
print '<br>';
$db->close();
print '<br>';
print '<br><br>';
llxFooter();
$db->close();
?>

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@@ -245,7 +245,7 @@ class FormMail
$out.= '<table class="border" width="100%">'."\n";
// Substitution array
if ($this->withsubstit)
if (! empty($this->withsubstit))
{
$out.= '<tr><td colspan="2">';
$help="";
@@ -258,9 +258,9 @@ class FormMail
}
// From
if ($this->withfrom)
if (! empty($this->withfrom))
{
if ($this->withfromreadonly)
if (! empty($this->withfromreadonly))
{
$out.= '<input type="hidden" id="fromname" name="fromname" value="'.$this->fromname.'" />';
$out.= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />';
@@ -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.= '<tr><td width="180">';
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.= '<input size="'.(is_array($this->withto)?"30":"60").'" id="sendto" name="sendto" value="'.(! is_array($this->withto) && ! is_numeric($this->withto)? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->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.= '<tr><td width="180">';
$out.= $form->textwithpicto($langs->trans("MailCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
@@ -413,12 +413,12 @@ class FormMail
else
{
$out.= '<input size="'.(is_array($this->withtocc)?"30":"60").'" id="sendtocc" name="sendtocc" value="'.((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->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.= '<tr><td width="180">';
$out.= $form->textwithpicto($langs->trans("MailCCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
$out.= '</td><td>';
if ($this->withtocccreadonly)
if (! empty($this->withtocccreadonly))
{
$out.= (! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))?$this->withtoccc:"";
}
else
{
$out.= '<input size="'.(is_array($this->withtoccc)?"30":"60").'" id="sendtoccc" name="sendtoccc" value="'.((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->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.= '<tr><td width="180">'.$langs->trans("DeliveryReceipt").'</td><td>';
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.= '<tr>';
$out.= '<td width="180">'.$langs->trans("MailFile").'</td>';
@@ -549,7 +549,7 @@ class FormMail
}
// Message
if ($this->withbody)
if (! empty($this->withbody))
{
$defaultmessage="";
@@ -617,7 +617,7 @@ class FormMail
$out.= "</td></tr>\n";
}
if ($this->withform)
if (! empty($this->withform))
{
$out.= '<tr><td align="center" colspan="2"><center>';
$out.= '<input class="button" type="submit" id="sendmail" name="sendmail" value="'.$langs->trans("SendMail").'"';
@@ -637,7 +637,7 @@ class FormMail
$out.= '</table>'."\n";
if ($this->withform) $out.= '</form>'."\n";
if (! empty($this->withform)) $out.= '</form>'."\n";
$out.= "<!-- Fin form mail -->\n";
return $out;

View File

@@ -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)
{