From e82923b5255f3b0a022daed7224fd193ab8f28ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 13:24:27 +0000 Subject: [PATCH] Fix: Removed warnings --- htdocs/adherents/admin/adherent.php | 6 +- htdocs/admin/clicktodial.php | 32 ++--- htdocs/admin/contract.php | 143 ++++++++++---------- htdocs/admin/dons.php | 202 ++++++++++++++-------------- htdocs/admin/fckeditor.php | 92 +++++++------ htdocs/admin/fichinter.php | 2 +- htdocs/admin/geoipmaxmind.php | 12 +- 7 files changed, 243 insertions(+), 246 deletions(-) diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 22498881a48..b42448ca39a 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -40,7 +40,7 @@ accessforbidden(); $typeconst=array('yesno','texte','chaine'); -$action = getpost("action"); +$action = GETPOST("action"); // Action mise a jour ou ajout d'une constante @@ -48,7 +48,7 @@ if ($action == 'update' || $action == 'add') { $const=GETPOST("constname"); $value=GETPOST("constvalue"); - + if (($const=='ADHERENT_CARD_TYPE' || $const=='ADHERENT_ETIQUETTE_TYPE') && $value == -1) $value=''; if ($const=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice @@ -62,7 +62,7 @@ if ($action == 'update' || $action == 'add') $type=$_POST["consttype"]; $constnote=GETPOST("constnote"); $res=dolibarr_set_const($db,$const,$value,$typeconst[$type],0,$constnote,$conf->entity); - + if (! $res > 0) $error++; if (! $error) diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 0d54b3af304..909a7978024 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -28,24 +28,24 @@ require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); $langs->load("admin"); -if (!$user->admin) - accessforbidden(); +if (!$user->admin) accessforbidden(); + +$action = GETPOST("action"); -$action = getpost("action"); /* * Actions */ if ($action == 'setvalue' && $user->admin) { - $result=dolibarr_set_const($db, "CLICKTODIAL_URL",GETPOST("url"),'chaine',0,'',$conf->entity); - if ($result >= 0) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; + $result=dolibarr_set_const($db, "CLICKTODIAL_URL",GETPOST("url"),'chaine',0,'',$conf->entity); + if ($result >= 0) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; } } @@ -87,11 +87,11 @@ print '
trans("Test"); + // Add a phone number to test + } + */ dol_htmloutput_mesg($mesg); diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index c8aa6b60388..4d23e5bb371 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -28,8 +28,7 @@ require_once(DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'); $langs->load("admin"); $langs->load("errors"); -if (!$user->admin) -accessforbidden(); +if (!$user->admin) accessforbidden(); $action = GETPOST("action"); $value = GETPOST("value"); @@ -46,13 +45,13 @@ if (empty($conf->global->CONTRACT_ADDON)) if ($action == 'updateMask') { - $maskconst=$_POST['maskconstcontract']; - $maskvalue=$_POST['maskcontract']; - if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; + $maskconst=$_POST['maskconstcontract']; + $maskvalue=$_POST['maskcontract']; + if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity); - if (! $error) + if (! $res > 0) $error++; + + if (! $error) { $mesg = "".$langs->trans("SetupSaved").""; } @@ -64,16 +63,16 @@ if ($action == 'updateMask') if ($action == 'setmod') { - dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity); } /* -// constants of magre model -if ($action == 'updateMatrice') dolibarr_set_const($db, "CONTRACT_NUM_MATRICE",$_POST["matrice"],'chaine',0,'',$conf->entity); -if ($action == 'updatePrefix') dolibarr_set_const($db, "CONTRACT_NUM_PREFIX",$_POST["prefix"],'chaine',0,'',$conf->entity); -if ($action == 'setOffset') dolibarr_set_const($db, "CONTRACT_NUM_DELTA",$_POST["offset"],'chaine',0,'',$conf->entity); -if ($action == 'setNumRestart') dolibarr_set_const($db, "CONTRACT_NUM_RESTART_BEGIN_YEAR",$_POST["numrestart"],'chaine',0,'',$conf->entity); -*/ + // constants of magre model + if ($action == 'updateMatrice') dolibarr_set_const($db, "CONTRACT_NUM_MATRICE",$_POST["matrice"],'chaine',0,'',$conf->entity); + if ($action == 'updatePrefix') dolibarr_set_const($db, "CONTRACT_NUM_PREFIX",$_POST["prefix"],'chaine',0,'',$conf->entity); + if ($action == 'setOffset') dolibarr_set_const($db, "CONTRACT_NUM_DELTA",$_POST["offset"],'chaine',0,'',$conf->entity); + if ($action == 'setNumRestart') dolibarr_set_const($db, "CONTRACT_NUM_RESTART_BEGIN_YEAR",$_POST["numrestart"],'chaine',0,'',$conf->entity); + */ /* * View @@ -106,29 +105,29 @@ $dir = "../includes/modules/contract/"; $handle = opendir($dir); if (is_resource($handle)) { - $var=true; + $var=true; - while (($file = readdir($handle))!==false) - { - if (substr($file, 0, 13) == 'mod_contract_' && substr($file, dol_strlen($file)-3, 3) == 'php') - { - $file = substr($file, 0, dol_strlen($file)-4); + while (($file = readdir($handle))!==false) + { + if (substr($file, 0, 13) == 'mod_contract_' && substr($file, dol_strlen($file)-3, 3) == 'php') + { + $file = substr($file, 0, dol_strlen($file)-4); - require_once(DOL_DOCUMENT_ROOT ."/includes/modules/contract/".$file.".php"); + require_once(DOL_DOCUMENT_ROOT ."/includes/modules/contract/".$file.".php"); - $module = new $file; + $module = new $file; - // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + // Show modules according to features level + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - if ($module->isEnabled()) - { - $var=!$var; - print ''.$module->nom."\n"; - print ''; - print $module->info(); - print ''; + if ($module->isEnabled()) + { + $var=!$var; + print ''.$module->nom."\n"; + print ''; + print $module->info(); + print ''; // Show example of numbering module print ''; @@ -137,49 +136,49 @@ if (is_resource($handle)) else print $tmp; print ''."\n"; - print ''; - if ($conf->global->CONTRACT_ADDON == "$file") - { - print img_picto($langs->trans("Activated"),'switch_on'); - } - else - { - print 'scandir.'&label='.urlencode($module->name).'">'; - print img_picto($langs->trans("Disabled"),'switch_off'); - print ''; - } - print ''; + print ''; + if ($conf->global->CONTRACT_ADDON == "$file") + { + print img_picto($langs->trans("Activated"),'switch_on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'">'; + print img_picto($langs->trans("Disabled"),'switch_off'); + print ''; + } + print ''; - $contract=new Contrat($db); - $contract->initAsSpecimen(); + $contract=new Contrat($db); + $contract->initAsSpecimen(); - // Info - $htmltooltip=''; - $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; - $facture->type=0; - $nextval=$module->getNextValue($mysoc,$contract); - if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval - { - $htmltooltip.=''.$langs->trans("NextValue").': '; - if ($nextval) - { - $htmltooltip.=$nextval.'
'; - } - else - { - $htmltooltip.=$langs->trans($module->error).'
'; - } - } + // Info + $htmltooltip=''; + $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; + $facture->type=0; + $nextval=$module->getNextValue($mysoc,$contract); + if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval + { + $htmltooltip.=''.$langs->trans("NextValue").': '; + if ($nextval) + { + $htmltooltip.=$nextval.'
'; + } + else + { + $htmltooltip.=$langs->trans($module->error).'
'; + } + } - print ''; - print $html->textwithpicto('',$htmltooltip,1,0); - print ''; + print ''; + print $html->textwithpicto('',$htmltooltip,1,0); + print ''; - print ''; - } - } - } - closedir($handle); + print ''; + } + } + } + closedir($handle); } print '
'; diff --git a/htdocs/admin/dons.php b/htdocs/admin/dons.php index 51326c51072..8daeb4cb2c2 100644 --- a/htdocs/admin/dons.php +++ b/htdocs/admin/dons.php @@ -27,53 +27,53 @@ require_once(DOL_DOCUMENT_ROOT."/compta/dons/class/don.class.php"); $langs->load("admin"); $langs->load("donations"); -if (!$user->admin) - accessforbidden(); - +if (!$user->admin) accessforbidden(); $typeconst=array('yesno','texte','chaine'); + /* * Action */ + if ($_GET["action"] == 'specimen') { - $modele=$_GET["module"]; + $modele=$_GET["module"]; - $don = new Don($db); - $don->initAsSpecimen(); + $don = new Don($db); + $don->initAsSpecimen(); - // Charge le modele - $dir = DOL_DOCUMENT_ROOT . "/includes/modules/dons/"; - $file = $modele.".modules.php"; - if (file_exists($dir.$file)) - { - $classname = $modele; - require_once($dir.$file); + // Charge le modele + $dir = DOL_DOCUMENT_ROOT . "/includes/modules/dons/"; + $file = $modele.".modules.php"; + if (file_exists($dir.$file)) + { + $classname = $modele; + require_once($dir.$file); - $obj = new $classname($db); + $obj = new $classname($db); - if ($obj->write_file($don,$langs) > 0) - { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=donation&file=SPECIMEN.html"); - return; - } - else - { - $mesg='
'.$obj->error.'
'; - dol_syslog($obj->error, LOG_ERR); - } - } - else - { - $mesg='
'.$langs->trans("ErrorModuleNotFound").'
'; - dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); - } + if ($obj->write_file($don,$langs) > 0) + { + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=donation&file=SPECIMEN.html"); + return; + } + else + { + $mesg='
'.$obj->error.'
'; + dol_syslog($obj->error, LOG_ERR); + } + } + else + { + $mesg='
'.$langs->trans("ErrorModuleNotFound").'
'; + dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); + } } if ($_GET["action"] == 'setdoc') { - $db->begin(); + $db->begin(); if (dolibarr_set_const($db, "DON_ADDON_MODEL",$_GET["value"],'chaine',0,'',$conf->entity)) { @@ -94,17 +94,17 @@ if ($_GET["action"] == 'setdoc') $result2=$db->query($sql); if ($result1 && $result2) { - $db->commit(); + $db->commit(); } else { - $db->rollback(); + $db->rollback(); } } if ($_GET["action"] == 'set') { - $type='donation'; + $type='donation'; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; $sql.= " VALUES ('".$db->escape($_GET["value"])."','".$type."',".$conf->entity.", "; $sql.= ($_GET["label"]?"'".$db->escape($_GET["label"])."'":'null').", "; @@ -148,18 +148,18 @@ $sql.= " WHERE type = '".$type."'"; $resql=$db->query($sql); if ($resql) { - $i = 0; - $num_rows=$db->num_rows($resql); - while ($i < $num_rows) - { - $array = $db->fetch_array($resql); - array_push($def, $array[0]); - $i++; - } + $i = 0; + $num_rows=$db->num_rows($resql); + while ($i < $num_rows) + { + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i++; + } } else { - dol_print_error($db); + dol_print_error($db); } print ''; @@ -186,74 +186,74 @@ if (is_resource($handle)) $name = substr($file, 0, dol_strlen($file) -12); $classname = substr($file, 0, dol_strlen($file) -12); - require_once($dir.'/'.$file); - $module=new $classname($db); + require_once($dir.'/'.$file); + $module=new $classname($db); - // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + // Show modules according to features level + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - if ($module->isEnabled()) - { - print ''; - print ''; + if ($module->isEnabled()) + { + print ''; + print ''; - // Active - if (in_array($name, $def)) - { - print "'; - } - else - { - print ""; - } + // Active + if (in_array($name, $def)) + { + print "'; + } + else + { + print ""; + } - // Defaut - print "'; + // Defaut + print "'; - // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') { $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; } - $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; - $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); - $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); - $text=''.img_object($langs->trans("Preview"),'generic').''; - print ''; + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); + $text=''.img_object($langs->trans("Preview"),'generic').''; + print ''; - print "\n"; - } + print "\n"; + } } } closedir($handle); diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 0b9e6fca54d..48aff03a4c3 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -30,8 +30,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); $langs->load("admin"); $langs->load("fckeditor"); -if (!$user->admin) - accessforbidden(); +if (!$user->admin) accessforbidden(); // Constante et traduction de la description du module $modules = array( @@ -67,26 +66,25 @@ $picto = array( * Actions */ - foreach($modules as $const => $desc) { - if ($_GET["action"] == 'activate_'.strtolower($const)) - { - dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1",'chaine',0,'',$conf->entity); - // Si fckeditor est active dans la description produit/service, on l'active dans les formulaires - if ($const == 'PRODUCTDESC' && $conf->global->PRODUIT_DESC_IN_FORM) - { - dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1",'chaine',0,'',$conf->entity); - } - Header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - if ($_GET["action"] == 'disable_'.strtolower($const)) - { - dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const,$conf->entity); - Header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } + if ($_GET["action"] == 'activate_'.strtolower($const)) + { + dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1",'chaine',0,'',$conf->entity); + // Si fckeditor est active dans la description produit/service, on l'active dans les formulaires + if ($const == 'PRODUCTDESC' && $conf->global->PRODUIT_DESC_IN_FORM) + { + dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1",'chaine',0,'',$conf->entity); + } + Header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + if ($_GET["action"] == 'disable_'.strtolower($const)) + { + dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const,$conf->entity); + Header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } } if ($_POST["save"]) @@ -118,34 +116,34 @@ print "\n"; // Modules foreach($modules as $const => $desc) { - // Si condition non remplie, on ne propose pas l'option - if (! $conditions[$const]) continue; + // Si condition non remplie, on ne propose pas l'option + if (! $conditions[$const]) continue; - $var=!$var; - print ""; - print ''; - print ''; - print '"; + print ''; + print ''; + print ''; - print ''; + print '"; - print ''; + print ""; + print ''; } print '
'; - echo $module->name; - print ''; - print $module->description; - print '
'; + echo $module->name; + print ''; + print $module->description; + print '\n"; - if ($conf->global->DON_ADDON_MODEL == $name) - { - print img_picto($langs->trans("Enabled"),'on'); - } - else - { - print ' '; - print ''; - print ''.img_picto($langs->trans("Enabled"),'on').''; - } - print '\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').''; - print "\n"; + if ($conf->global->DON_ADDON_MODEL == $name) + { + print img_picto($langs->trans("Enabled"),'on'); + } + else + { + print ' '; + print ''; + print ''.img_picto($langs->trans("Enabled"),'on').''; + } + print '\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').''; + print ""; - if ($conf->global->DON_ADDON_MODEL == "$name") - { - print img_picto($langs->trans("Default"),'on'); - } - else - { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; - } - print '"; + if ($conf->global->DON_ADDON_MODEL == "$name") + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + } + print ''; - print $html->textwithpicto('   '.$text,$htmltooltip,-1,0); - print ''; + print $html->textwithpicto('   '.$text,$htmltooltip,-1,0); + print '
'.img_object("",$picto[$const]).''.$langs->trans($desc).''; + $var=!$var; + print "
'.img_object("",$picto[$const]).''.$langs->trans($desc).''; - $constante = 'FCKEDITOR_ENABLE_'.$const; - $value = $conf->global->$constante; + $constante = 'FCKEDITOR_ENABLE_'.$const; + $value = $conf->global->$constante; - print $value == 1 ? img_picto($langs->trans("Active"),'tick') : ' '; + print $value == 1 ? img_picto($langs->trans("Active"),'tick') : ' '; - print ''; + print ''; - if($value == 0) - { - print ''.$langs->trans("Activate").''; - } - else if($value == 1) - { - print ''.$langs->trans("Disable").''; - } + if($value == 0) + { + print ''.$langs->trans("Activate").''; + } + else if($value == 1) + { + print ''.$langs->trans("Disable").''; + } - print "
'."\n"; @@ -162,11 +160,11 @@ print '

'; -print $_POST["formtestfield"]; -print ''; -print $conf->global->FCKEDITOR_TEST; -*/ + print ''; + print $_POST["formtestfield"]; + print ''; + print $conf->global->FCKEDITOR_TEST; + */ $db->close(); diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 105328889bc..fad66ceae73 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -48,7 +48,7 @@ $value = GETPOST("value"); if ($action == 'updateMask') { $maskconst=GETPOST("maskconst"); - $maskvalue=getpost("maskvalue"); + $maskvalue=GETPOST("maskvalue"); if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php index 9f74670571f..4c36de52c91 100644 --- a/htdocs/admin/geoipmaxmind.php +++ b/htdocs/admin/geoipmaxmind.php @@ -1,7 +1,7 @@ * Copyright (C) 2011 Juanjo Menent - * + * * 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 * the Free Software Foundation; either version 2 of the License, or @@ -41,20 +41,20 @@ $action = GETPOST("action"); if ($action == 'set') { $error=0; - - $gimcdf= getpost("GEOIPMAXMIND_COUNTRY_DATAFILE"); - + + $gimcdf= GETPOST("GEOIPMAXMIND_COUNTRY_DATAFILE"); + if (! $gimcdf && ! file_exists($gimcdf)) { $mesg='
'.$langs->trans("ErrorFileNotFound",$gimcdf).'
'; $error++; } - + if (! $error) { $res = dolibarr_set_const($db,"GEOIPMAXMIND_COUNTRY_DATAFILE",$gimcdf,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; - + if (! $error) { $mesg = "".$langs->trans("SetupSaved")."";