From a08fed36c4be5583833f98a309b4e1ce17cc389e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Dec 2022 18:42:12 +0100 Subject: [PATCH] Fix warnings, deadcode --- htdocs/api/admin/index.php | 10 +++++----- htdocs/ftp/index.php | 39 ++++---------------------------------- htdocs/index.php | 17 ----------------- 3 files changed, 9 insertions(+), 57 deletions(-) diff --git a/htdocs/api/admin/index.php b/htdocs/api/admin/index.php index b9548c7f69e..d618c65836b 100644 --- a/htdocs/api/admin/index.php +++ b/htdocs/api/admin/index.php @@ -71,7 +71,7 @@ if ($action == 'setproductionmode') { } // Disable compression mode -if ($action == 'setdisablecomprssion') { +if ($action == 'setdisablecompression') { $status = GETPOST('status', 'alpha'); if (dolibarr_set_const($db, 'API_DISABLE_COMPRESSION', $status, 'chaine', 0, '', 0) > 0) { @@ -118,11 +118,11 @@ print ''; print ''.$langs->trans("ApiProductionMode").''; $production_mode = (empty($conf->global->API_PRODUCTION_MODE) ?false:true); if ($production_mode) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -133,11 +133,11 @@ print ''; print ''.$langs->trans("API_DISABLE_COMPRESSION").''; $disable_compression = (empty($conf->global->API_DISABLE_COMPRESSION) ?false:true); if ($disable_compression) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php index 6222d3db8bd..af48f0f8348 100644 --- a/htdocs/ftp/index.php +++ b/htdocs/ftp/index.php @@ -98,41 +98,6 @@ $mesg = ''; * ACTIONS */ -// Submit file -if (GETPOST("sendit") && !empty($conf->global->MAIN_UPLOAD_DOC)) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - $result = $ecmdir->fetch(GETPOST("section", 'int')); - if (!($result > 0)) { - dol_print_error($db, $ecmdir->error); - exit; - } - $relativepath = $ecmdir->getRelativePath(); - $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; - - if (dol_mkdir($upload_dir) >= 0) { - $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir."/".dol_unescapefile($_FILES['userfile']['name']), 0); - if (is_numeric($resupload) && $resupload > 0) { - $result = $ecmdir->changeNbOfFiles('+'); - } else { - $langs->load("errors"); - if ($resupload < 0) { // Unknown error - setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors'); - } elseif (preg_match('/ErrorFileIsInfectedWithAVirus/', $resupload)) { - // Files infected by a virus - setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors'); - } else // Known error - { - setEventMessages($langs->trans($resupload), null, 'errors'); - } - } - } else { - // Transfer failure (file exceeding the limit ?) - $langs->load("errors"); - setEventMessages($langs->trans("ErrorFailToCreateDir", $upload_dir), null, 'errors'); - } -} - if ($action == 'uploadfile') { // set up a connection or die if (!$conn_id) { @@ -661,6 +626,7 @@ if (!function_exists('ftp_connect')) { print ''; print ""; + if ($user->hasRight('ftp', 'write')) { print load_fiche_titre($langs->trans("AttachANewFile"), null, null); print '
'; @@ -672,6 +638,9 @@ if (!function_exists('ftp_connect')) { print ''; print ''; print '
'; + + print '

'; + print load_fiche_titre($langs->trans("AddFolder"), null, null); print '
'; print ''; diff --git a/htdocs/index.php b/htdocs/index.php index d08e2a0b510..f0fe4a8e4cc 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -512,23 +512,6 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { if (!empty($groupElement['globalStatsKey']) && empty($groupElement['globalStats'])) { // can be filled by hook $globalStatsKey = $groupElement['globalStatsKey']; $groupElement['globalStats'] = array(); - - if (isset($keys) && is_array($keys) && in_array($globalStatsKey, $keys)) { - // get key index of stats used in $includes, $classes, $keys, $icons, $titres, $links - $keyIndex = array_search($globalStatsKey, $keys); - - $classe = (!empty($classes[$keyIndex]) ? $classes[$keyIndex] : ''); - if (isset($boardloaded[$classe]) && is_object($boardloaded[$classe])) { - $groupElement['globalStats']['total'] = $boardloaded[$classe]->nb[$globalStatsKey] ? $boardloaded[$classe]->nb[$globalStatsKey] : 0; - $nbTotal = floatval($groupElement['globalStats']['total']); - if ($nbTotal >= 10000) { - $nbTotal = round($nbTotal / 1000, 2).'k'; - } - $groupElement['globalStats']['text'] = $langs->trans('Total').' : '.$langs->trans($titres[$keyIndex]).' ('.$groupElement['globalStats']['total'].')'; - $groupElement['globalStats']['total'] = $nbTotal; - //$groupElement['globalStats']['link'] = $links[$keyIndex]; - } - } } $openedDashBoard .= '
'."\n";