mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-08 02:28:23 +01:00
Fix compatibility with the removal of "constant".
This commit is contained in:
@@ -40,7 +40,7 @@ $action = GETPOST("action");
|
|||||||
$syslogModules = array();
|
$syslogModules = array();
|
||||||
$activeModules = array();
|
$activeModules = array();
|
||||||
|
|
||||||
if (defined('SYSLOG_HANDLERS')) $activeModules = json_decode(constant('SYSLOG_HANDLERS'));
|
if (! empty($conf->global->SYSLOG_HANDLERS)) $activeModules = json_decode($conf->global->SYSLOG_HANDLERS);
|
||||||
|
|
||||||
$dirsyslogs = array_merge(array('/core/modules/syslog/'), $conf->modules_parts['syslog']);
|
$dirsyslogs = array_merge(array('/core/modules/syslog/'), $conf->modules_parts['syslog']);
|
||||||
foreach ($dirsyslogs as $reldir) {
|
foreach ($dirsyslogs as $reldir) {
|
||||||
@@ -88,7 +88,8 @@ if ($action == 'set')
|
|||||||
|
|
||||||
$newActiveModules = array();
|
$newActiveModules = array();
|
||||||
$selectedModules = (isset($_POST['SYSLOG_HANDLERS']) ? $_POST['SYSLOG_HANDLERS'] : array());
|
$selectedModules = (isset($_POST['SYSLOG_HANDLERS']) ? $_POST['SYSLOG_HANDLERS'] : array());
|
||||||
//var_dump($selectedModules);
|
|
||||||
|
// Save options of handler
|
||||||
foreach ($syslogModules as $syslogHandler)
|
foreach ($syslogModules as $syslogHandler)
|
||||||
{
|
{
|
||||||
if (in_array($syslogHandler, $syslogModules))
|
if (in_array($syslogHandler, $syslogModules))
|
||||||
@@ -101,7 +102,7 @@ if ($action == 'set')
|
|||||||
if (isset($_POST[$option['constant']]))
|
if (isset($_POST[$option['constant']]))
|
||||||
{
|
{
|
||||||
$_POST[$option['constant']] = trim($_POST[$option['constant']]);
|
$_POST[$option['constant']] = trim($_POST[$option['constant']]);
|
||||||
dolibarr_del_const($db, $option['constant'], 0);
|
dolibarr_del_const($db, $option['constant'], -1);
|
||||||
dolibarr_set_const($db, $option['constant'], $_POST[$option['constant']], 'chaine',0, '', 0);
|
dolibarr_set_const($db, $option['constant'], $_POST[$option['constant']], 'chaine',0, '', 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,7 +110,9 @@ if ($action == 'set')
|
|||||||
}
|
}
|
||||||
|
|
||||||
$activeModules = $newActiveModules;
|
$activeModules = $newActiveModules;
|
||||||
dolibarr_set_const($db, 'SYSLOG_HANDLERS', json_encode($activeModules), 'chaine',0,'',0);
|
|
||||||
|
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
|
// Check configuration
|
||||||
foreach ($activeModules as $modulename) {
|
foreach ($activeModules as $modulename) {
|
||||||
@@ -217,8 +220,12 @@ foreach ($syslogModules as $moduleName)
|
|||||||
{
|
{
|
||||||
foreach ($setuparray as $option)
|
foreach ($setuparray as $option)
|
||||||
{
|
{
|
||||||
if (isset($_POST[$option['constant']])) $value=$_POST[$option['constant']];
|
$tmpoption=$option['constant'];
|
||||||
else if (defined($option['constant'])) $value = constant($option['constant']);
|
if (! empty($tmpoption))
|
||||||
|
{
|
||||||
|
if (isset($_POST[$tmpoption])) $value=$_POST[$tmpoption];
|
||||||
|
else if (! empty($conf->global->$tmpoption)) $value = $conf->global->$tmpoption;
|
||||||
|
}
|
||||||
else $value = (isset($option['default']) ? $option['default'] : '');
|
else $value = (isset($option['default']) ? $option['default'] : '');
|
||||||
|
|
||||||
print $option['name'].': <input type="text" class="flat" name="'.$option['constant'].'" value="'.$value.'"'.(isset($option['attr']) ? ' '.$option['attr'] : '').'>';
|
print $option['name'].': <input type="text" class="flat" name="'.$option['constant'].'" value="'.$value.'"'.(isset($option['attr']) ? ' '.$option['attr'] : '').'>';
|
||||||
|
|||||||
@@ -80,8 +80,11 @@ class box_external_rss extends ModeleBoxes
|
|||||||
// documents/externalrss is created by module activation
|
// documents/externalrss is created by module activation
|
||||||
// documents/externalrss/tmp is created by rssparser
|
// documents/externalrss/tmp is created by rssparser
|
||||||
|
|
||||||
|
$keyforparamurl="EXTERNAL_RSS_URLRSS_".$site;
|
||||||
|
$keyforparamtitle="EXTERNAL_RSS_TITLE_".$site;
|
||||||
|
|
||||||
// Get RSS feed
|
// Get RSS feed
|
||||||
$url=@constant("EXTERNAL_RSS_URLRSS_".$site);
|
$url=$conf->global->$keyforparamurl;
|
||||||
|
|
||||||
$rssparser=new RssParser($this->db);
|
$rssparser=new RssParser($this->db);
|
||||||
$result = $rssparser->parser($url, $this->max, $cachedelay, $conf->externalrss->dir_temp);
|
$result = $rssparser->parser($url, $this->max, $cachedelay, $conf->externalrss->dir_temp);
|
||||||
@@ -90,7 +93,7 @@ class box_external_rss extends ModeleBoxes
|
|||||||
$description=$rssparser->getDescription();
|
$description=$rssparser->getDescription();
|
||||||
$link=$rssparser->getLink();
|
$link=$rssparser->getLink();
|
||||||
|
|
||||||
$title=$langs->trans("BoxTitleLastRssInfos",$max, @constant("EXTERNAL_RSS_TITLE_". $site));
|
$title=$langs->trans("BoxTitleLastRssInfos", $max, $conf->global->$keyforparamtitle);
|
||||||
if ($result < 0 || ! empty($rssparser->error))
|
if ($result < 0 || ! empty($rssparser->error))
|
||||||
{
|
{
|
||||||
// Show warning
|
// Show warning
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ class Conf
|
|||||||
$file=dol_sanitizeFileName($file);
|
$file=dol_sanitizeFileName($file);
|
||||||
include_once DOL_DOCUMENT_ROOT . "/".$file."/".$file."_consts.php";
|
include_once DOL_DOCUMENT_ROOT . "/".$file."/".$file."_consts.php";
|
||||||
foreach ($file2bddconsts as $key=>$value) {
|
foreach ($file2bddconsts as $key=>$value) {
|
||||||
$this->global->$key=constant($value);
|
$this->global->$key=$value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1495,10 +1495,10 @@ function dol_uncompress($inputfile,$outputdir)
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
if (defined('ODTPHP_PATHTOPCLZIP'))
|
if (! empty($conf->global->ODTPHP_PATHTOPCLZIP))
|
||||||
{
|
{
|
||||||
dol_syslog("Constant ODTPHP_PATHTOPCLZIP for pclzip library is set to ".constant('ODTPHP_PATHTOPCLZIP').", so we use Pclzip to unzip into ".$outputdir);
|
dol_syslog("Constant ODTPHP_PATHTOPCLZIP for pclzip library is set to ".$conf->global->ODTPHP_PATHTOPCLZIP.", so we use Pclzip to unzip into ".$outputdir);
|
||||||
include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php';
|
include_once $conf->global->ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php';
|
||||||
$archive = new PclZip($inputfile);
|
$archive = new PclZip($inputfile);
|
||||||
$result=$archive->extract(PCLZIP_OPT_PATH, $outputdir);
|
$result=$archive->extract(PCLZIP_OPT_PATH, $outputdir);
|
||||||
//var_dump($result);
|
//var_dump($result);
|
||||||
|
|||||||
@@ -3570,14 +3570,14 @@ function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
|
|||||||
$morelabel=' ('.$reg[1].')';
|
$morelabel=' ('.$reg[1].')';
|
||||||
$rate=preg_replace('/\s*'.preg_quote($morelabel,'/').'/','',$rate);
|
$rate=preg_replace('/\s*'.preg_quote($morelabel,'/').'/','',$rate);
|
||||||
}
|
}
|
||||||
if (preg_match('/\*/',$rate) || preg_match('/'.constant('MAIN_LABEL_MENTION_NPR').'/i',$rate))
|
if (preg_match('/\*/',$rate))
|
||||||
{
|
{
|
||||||
$rate=str_replace('*','',$rate);
|
$rate=str_replace('*','',$rate);
|
||||||
$info_bits |= 1;
|
$info_bits |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret=price($rate,0,'',0,0).($addpercent?'%':'');
|
$ret=price($rate,0,'',0,0).($addpercent?'%':'');
|
||||||
if ($info_bits & 1) $ret.=' '.($usestarfornpr?'*':constant('MAIN_LABEL_MENTION_NPR'));
|
if ($info_bits & 1) $ret.=' *';
|
||||||
$ret.=$morelabel;
|
$ret.=$morelabel;
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,9 +150,9 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
|||||||
|
|
||||||
// Title
|
// Title
|
||||||
$appli=constant('DOL_APPLICATION_TITLE');
|
$appli=constant('DOL_APPLICATION_TITLE');
|
||||||
$title=$appli.' '.DOL_VERSION;
|
$title=$appli.' '.constant('DOL_VERSION');
|
||||||
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
|
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
|
||||||
$titletruedolibarrversion=DOL_VERSION; // $title used by login template after the @ to inform of true Dolibarr version
|
$titletruedolibarrversion=constant('DOL_VERSION'); // $title used by login template after the @ to inform of true Dolibarr version
|
||||||
|
|
||||||
// Note: $conf->css looks like '/theme/eldy/style.css.php'
|
// Note: $conf->css looks like '/theme/eldy/style.css.php'
|
||||||
$conf->css = "/theme/".(GETPOST('theme')?GETPOST('theme','alpha'):$conf->theme)."/style.css.php";
|
$conf->css = "/theme/".(GETPOST('theme')?GETPOST('theme','alpha'):$conf->theme)."/style.css.php";
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
return $this->isActive()?'':$langs->trans('ClassNotFoundIntoPathWarning','ChromePhp.class.php');
|
return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning','ChromePhp.class.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,7 +73,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
|
|||||||
|
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
return 1;
|
return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_CHROMEPHP to 1 to disable this loghandler
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
|
|||||||
*/
|
*/
|
||||||
public function isActive()
|
public function isActive()
|
||||||
{
|
{
|
||||||
return 1;
|
global $conf;
|
||||||
|
return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_FILE)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_FILE to 1 to disable this loghandler
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
return $this->isActive()?'':$langs->trans('ClassNotFoundIntoPathWarning', self::$firephp_class_path);
|
return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning', self::$firephp_class_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,7 +76,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
|
|||||||
$res = @include_once self::$firephp_class_path;
|
$res = @include_once self::$firephp_class_path;
|
||||||
restore_include_path();
|
restore_include_path();
|
||||||
if ($res) {
|
if ($res) {
|
||||||
return 1;
|
return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_FIREPHP)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_FIREPHP to 1 to disable this loghandler
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,10 +48,12 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
|
|||||||
*/
|
*/
|
||||||
public function isActive()
|
public function isActive()
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
// This function does not exists on some ISP (Ex: Free in France)
|
// This function does not exists on some ISP (Ex: Free in France)
|
||||||
if (!function_exists('openlog')) return 0;
|
if (!function_exists('openlog')) return 0;
|
||||||
|
|
||||||
return 1;
|
return empty($conf->global->SYSLOG_DISABLE_LOGHANDLER_SYSLOG)?1:0; // Set SYSLOG_DISABLE_LOGHANDLER_SYSLOG to 1 to disable this loghandler
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,11 +113,11 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
|
|||||||
|
|
||||||
if (! empty($conf->global->MAIN_SYSLOG_DISABLE_SYSLOG)) return; // Global option to disable output of this handler
|
if (! empty($conf->global->MAIN_SYSLOG_DISABLE_SYSLOG)) return; // Global option to disable output of this handler
|
||||||
|
|
||||||
if (! empty($conf->global->SYSLOG_FACILITY))
|
if (! empty($conf->global->SYSLOG_FACILITY)) // Example LOG_USER
|
||||||
{
|
{
|
||||||
$facility = constant($conf->global->SYSLOG_FACILITY);
|
$facility = constant($conf->global->SYSLOG_FACILITY);
|
||||||
}
|
}
|
||||||
else $facility = LOG_USER;
|
else $facility = constant('LOG_USER');
|
||||||
|
|
||||||
// (int) is required to avoid error parameter 3 expected to be long
|
// (int) is required to avoid error parameter 3 expected to be long
|
||||||
openlog('dolibarr', LOG_PID | LOG_PERROR, (int) $facility);
|
openlog('dolibarr', LOG_PID | LOG_PERROR, (int) $facility);
|
||||||
|
|||||||
@@ -247,40 +247,46 @@ else
|
|||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
|
$keyforname="FTP_NAME_" . $idrss;
|
||||||
|
$keyforserver="FTP_SERVER_" . $idrss;
|
||||||
|
$keyforport="FTP_PORT_" . $idrss;
|
||||||
|
$keyforuser="FTP_USER_" . $idrss;
|
||||||
|
$keyforpassword="FTP_PASSWORD_" . $idrss;
|
||||||
|
$keyforpassive="FTP_PASSIVE_" . $idrss;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td>".$langs->trans("Name")."</td>";
|
print "<td>".$langs->trans("Name")."</td>";
|
||||||
print "<td><input type=\"text\" class=\"flat\" name=\"FTP_NAME_" . $idrss . "\" value=\"" . @constant("FTP_NAME_" . $idrss) . "\" size=\"64\"></td>";
|
print "<td><input type=\"text\" class=\"flat\" name=\"FTP_NAME_" . $idrss . "\" value=\"" . $conf->global->$keyforname . "\" size=\"64\"></td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td>".$langs->trans("Server")."</td>";
|
print "<td>".$langs->trans("Server")."</td>";
|
||||||
print "<td><input type=\"text\" class=\"flat\" name=\"FTP_SERVER_" . $idrss . "\" value=\"" . @constant("FTP_SERVER_" . $idrss) . "\" size=\"64\"></td>";
|
print "<td><input type=\"text\" class=\"flat\" name=\"FTP_SERVER_" . $idrss . "\" value=\"" . $conf->global->$keyforserver . "\" size=\"64\"></td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td width=\"100\">".$langs->trans("Port")."</td>";
|
print "<td width=\"100\">".$langs->trans("Port")."</td>";
|
||||||
print "<td><input type=\"text\" class=\"flat\" name=\"FTP_PORT_" . $idrss . "\" value=\"" . @constant("FTP_PORT_" . $idrss) . "\" size=\"64\"></td>";
|
print "<td><input type=\"text\" class=\"flat\" name=\"FTP_PORT_" . $idrss . "\" value=\"" . $conf->global->$keyforport . "\" size=\"64\"></td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td width=\"100\">".$langs->trans("User")."</td>";
|
print "<td width=\"100\">".$langs->trans("User")."</td>";
|
||||||
print "<td><input type=\"text\" class=\"flat\" name=\"FTP_USER_" . $idrss . "\" value=\"" . @constant("FTP_USER_" . $idrss) . "\" size=\"24\"></td>";
|
print "<td><input type=\"text\" class=\"flat\" name=\"FTP_USER_" . $idrss . "\" value=\"" . $conf->global->$keyforuser . "\" size=\"24\"></td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td width=\"100\">".$langs->trans("Password")."</td>";
|
print "<td width=\"100\">".$langs->trans("Password")."</td>";
|
||||||
print "<td><input type=\"password\" class=\"flat\" name=\"FTP_PASSWORD_" . $idrss . "\" value=\"" . @constant("FTP_PASSWORD_" . $idrss) . "\" size=\"24\"></td>";
|
print "<td><input type=\"password\" class=\"flat\" name=\"FTP_PASSWORD_" . $idrss . "\" value=\"" . $conf->global->$keyforpassword . "\" size=\"24\"></td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td width=\"100\">".$langs->trans("FTPPassiveMode")."</td>";
|
print "<td width=\"100\">".$langs->trans("FTPPassiveMode")."</td>";
|
||||||
print '<td>'.$form->selectyesno('FTP_PASSIVE_'.$idrss, @constant("FTP_PASSIVE_" . $idrss), 1).'</td>';
|
print '<td>'.$form->selectyesno('FTP_PASSIVE_'.$idrss, $conf->global->$keyforpassive, 1).'</td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
|
|||||||
@@ -1865,7 +1865,7 @@ if (! function_exists("llxFooter"))
|
|||||||
dol_htmloutput_events();
|
dol_htmloutput_events();
|
||||||
|
|
||||||
// Core error message
|
// Core error message
|
||||||
if (defined("MAIN_CORE_ERROR") && constant("MAIN_CORE_ERROR") == 1)
|
if (! empty($conf->global->MAIN_CORE_ERROR))
|
||||||
{
|
{
|
||||||
// Ajax version
|
// Ajax version
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
|
|||||||
Reference in New Issue
Block a user