mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Help/Need debug of some online instances with the log view
This commit is contained in:
parent
3873bc7433
commit
ec9bbe2b52
|
|
@ -88,7 +88,7 @@ if ($action == 'set')
|
|||
|
||||
$newActiveModules = array();
|
||||
$selectedModules = (isset($_POST['SYSLOG_HANDLERS']) ? $_POST['SYSLOG_HANDLERS'] : array());
|
||||
|
||||
|
||||
// Save options of handler
|
||||
foreach ($syslogModules as $syslogHandler)
|
||||
{
|
||||
|
|
@ -111,7 +111,7 @@ if ($action == 'set')
|
|||
|
||||
$activeModules = $newActiveModules;
|
||||
|
||||
dolibarr_del_const($db, 'SYSLOG_HANDLERS', -1); // To be sure ther is not a setup into another entity
|
||||
dolibarr_del_const($db, 'SYSLOG_HANDLERS', -1); // To be sure ther is not a setup into another entity
|
||||
dolibarr_set_const($db, 'SYSLOG_HANDLERS', json_encode($activeModules), 'chaine',0,'',0);
|
||||
|
||||
// Check configuration
|
||||
|
|
@ -206,7 +206,7 @@ foreach ($syslogModules as $moduleName)
|
|||
//print $moduleName." = ".$moduleactive." - ".$module->getName()." ".($moduleactive == -1)."<br>\n";
|
||||
if (($moduleactive == -1) && empty($conf->global->MAIN_FEATURES_LEVEL)) continue; // Some modules are hidden if not activable and not into debug mode (end user must not see them)
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="140">';
|
||||
print '<input class="oddeven" type="checkbox" name="SYSLOG_HANDLERS[]" value="'.$moduleName.'" '.(in_array($moduleName, $activeModules) ? 'checked' : '').($moduleactive <= 0 ? 'disabled' : '').'> ';
|
||||
|
|
@ -229,6 +229,14 @@ foreach ($syslogModules as $moduleName)
|
|||
|
||||
print $option['name'].': <input type="text" class="flat" name="'.$option['constant'].'" value="'.$value.'"'.(isset($option['attr']) ? ' '.$option['attr'] : '').'>';
|
||||
if (! empty($option['example'])) print '<br>'.$langs->trans("Example").': '.$option['example'];
|
||||
|
||||
if ($option['constant'] == 'SYSLOG_FILE' && preg_match('/^DOL_DATA_ROOT\/[^\/]*$/',$value))
|
||||
{
|
||||
$filelogparam =' (<a href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file='.basename($value).'">';
|
||||
$filelogparam.=$langs->trans('Download');
|
||||
$filelogparam.=$filelog.'</a>)';
|
||||
print $filelogparam;
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
|
|
|||
|
|
@ -83,7 +83,15 @@ if (! empty($conf->syslog->enabled))
|
|||
{
|
||||
print '<input type="radio" name="choice" value="logfile"';
|
||||
print ($choice && $choice=='logfile') ? ' checked' : '';
|
||||
print '> '.$langs->trans("PurgeDeleteLogFile",$filelog).'<br><br>';
|
||||
$filelogparam=$filelog;
|
||||
if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog)))
|
||||
{
|
||||
$filelogparam ='<a href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file=';
|
||||
$filelogparam.=basename($filelog);
|
||||
$filelogparam.='">'.$filelog.'</a>';
|
||||
}
|
||||
print '> '.$langs->trans("PurgeDeleteLogFile", $filelogparam);
|
||||
print '<br><br>';
|
||||
}
|
||||
|
||||
print '<input type="radio" name="choice" value="tempfiles"';
|
||||
|
|
|
|||
|
|
@ -1825,8 +1825,20 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
|||
$lire='creer'; $read='write'; $download='upload';
|
||||
}
|
||||
|
||||
// Wrapping for miscellaneous medias files
|
||||
if ($modulepart == 'medias' && !empty($dolibarr_main_data_root))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$dolibarr_main_data_root.'/medias/'.$original_file;
|
||||
}
|
||||
// Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log
|
||||
elseif ($modulepart == 'logs' && !empty($dolibarr_main_data_root))
|
||||
{
|
||||
$accessallowed=($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.log$/', basename($original_file)));
|
||||
$original_file=$dolibarr_main_data_root.'/'.$original_file;
|
||||
}
|
||||
// Wrapping for some images
|
||||
if (($modulepart == 'mycompany' || $modulepart == 'companylogo') && !empty($conf->mycompany->dir_output))
|
||||
elseif (($modulepart == 'mycompany' || $modulepart == 'companylogo') && !empty($conf->mycompany->dir_output))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->mycompany->dir_output.'/logos/'.$original_file;
|
||||
|
|
@ -2369,13 +2381,6 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
|||
$original_file=$conf->fckeditor->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for miscellaneous medias files
|
||||
elseif ($modulepart == 'medias' && !empty($dolibarr_main_data_root))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$dolibarr_main_data_root.'/medias/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for backups
|
||||
else if ($modulepart == 'systemtools' && !empty($conf->admin->dir_output))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
* \brief Wrapper to download data files
|
||||
* \remarks Call of this wrapper is made with URL:
|
||||
* document.php?modulepart=repfichierconcerne&file=pathrelatifdufichier
|
||||
* document.php?modulepart=logs&file=dolibarr.log
|
||||
*/
|
||||
|
||||
define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
|
|
@ -106,7 +107,7 @@ $refname=basename(dirname($original_file)."/");
|
|||
|
||||
// Security check
|
||||
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
|
||||
$check_access = dol_check_secure_access_document($modulepart,$original_file,$entity,$refname);
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$original_file = $check_access['original_file']; // original_file is now a full path name
|
||||
|
|
@ -183,7 +184,7 @@ header('Pragma: public');
|
|||
|
||||
//ob_clean();
|
||||
//flush();
|
||||
|
||||
|
||||
readfile($original_file_osencoded);
|
||||
|
||||
if (is_object($db)) $db->close();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user