mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix warnings, deadcode
This commit is contained in:
parent
3f99670b97
commit
c298f22a4f
|
|
@ -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 '<tr class="oddeven">';
|
|||
print '<td>'.$langs->trans("ApiProductionMode").'</td>';
|
||||
$production_mode = (empty($conf->global->API_PRODUCTION_MODE) ?false:true);
|
||||
if ($production_mode) {
|
||||
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&token='.newToken().'&value='.($i + 1).'&status=0">';
|
||||
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&token='.newToken().'&status=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&token='.newToken().'&value='.($i + 1).'&status=1">';
|
||||
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&token='.newToken().'&status=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
|
|
@ -133,11 +133,11 @@ print '<tr class="oddeven">';
|
|||
print '<td>'.$langs->trans("API_DISABLE_COMPRESSION").'</td>';
|
||||
$disable_compression = (empty($conf->global->API_DISABLE_COMPRESSION) ?false:true);
|
||||
if ($disable_compression) {
|
||||
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisablecomprssion&token='.newToken().'&value='.($i + 1).'&status=0">';
|
||||
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisablecompression&token='.newToken().'&status=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisablecomprssion&token='.newToken().'&value='.($i + 1).'&status=1">';
|
||||
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisablecompression&token='.newToken().'&status=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 '</div>';
|
||||
|
||||
print "</form>";
|
||||
|
||||
if ($user->hasRight('ftp', 'write')) {
|
||||
print load_fiche_titre($langs->trans("AttachANewFile"), null, null);
|
||||
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
|
|
@ -672,6 +638,9 @@ if (!function_exists('ftp_connect')) {
|
|||
print '<td></td>';
|
||||
print '<td align="center"><button type="submit" class="butAction" name="uploadfile" value="'.$langs->trans("Save").'">'.$langs->trans("Upload").'</button></td>';
|
||||
print '</form>';
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
print load_fiche_titre($langs->trans("AddFolder"), null, null);
|
||||
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
|
|
|||
|
|
@ -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 .= '<div class="box-flex-item"><div class="box-flex-item-with-margin">'."\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user