diff --git a/ChangeLog b/ChangeLog index 5c31ad7e3b587d801d67fa83db495774d62bedd9..aec1ba170231cef38a1468abaace7367b0fbf376 100644 --- a/ChangeLog +++ b/ChangeLog @@ -62,6 +62,7 @@ For developers: - New: Basic implementation of hooks and triggers for a lot (most) of core modules: action/calendar, trips and expenses, dons, vat payment, contact/society, contract, product lines, expedition, order supplier and order invoice (lines included), intervention card, project, tasks. +- New: Add ChromePHP output into syslog module. For translators: - New: Update language files (de, tr, pt, ca, es, en, fr). diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 312a99649c2ef0790e679f5939fd55c1a2be5681..d1abf15f34502fa9555dcfe679e87af9c080584c 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -35,7 +35,8 @@ $error=0; $mesg=''; $action = GETPOST("action"); $syslog_file_on=(defined('SYSLOG_FILE_ON') && constant('SYSLOG_FILE_ON'))?1:0; $syslog_syslog_on=(defined('SYSLOG_SYSLOG_ON') && constant('SYSLOG_SYSLOG_ON'))?1:0; -$syslog_firephp_on=(defined('SYSLOG_FIREPHP_ON') && constant('SYSLOG_FIREPHP_ON'))?1:0; +$syslog_firephp_on=(defined('SYSLOG_FIREPHP_ON') && constant('SYSLOG_FIREPHP_ON'))?1:0; +$syslog_chromephp_on=(defined('SYSLOG_CHROMEPHP_ON') && constant('SYSLOG_CHROMEPHP_ON'))?1:0; /* @@ -54,6 +55,7 @@ if ($action == 'set') $syslog_file_on=0; $syslog_syslog_on=0; $syslog_firephp_on=0; + $syslog_chromephp_on=0; if (! $error && GETPOST("filename")) { @@ -99,13 +101,19 @@ if ($action == 'set') } } - if (! $error && isset($_POST['SYSLOG_FIREPHP_ON'])) // If firephp no available, post is not present + if (! $error && isset($_POST['SYSLOG_FIREPHP_ON'])) // If firephp no available, post is not present. We must keep isset here. { $syslog_firephp_on=GETPOST('SYSLOG_FIREPHP_ON'); if (! $error) $res = dolibarr_set_const($db,"SYSLOG_FIREPHP_ON",$syslog_firephp_on,'chaine',0,'',0); } - if (! $error) + if (! $error && isset($_POST['SYSLOG_CHROMEPHP_ON'])) // If chromephp no available, post is not present. We must keep isset here. + { + $syslog_chromephp_on=GETPOST('SYSLOG_CHROMEPHP_ON'); + if (! $error) $res = dolibarr_set_const($db,"SYSLOG_CHROMEPHP_ON",$syslog_chromephp_on,'chaine',0,'',0); + } + + if (! $error) { $db->commit(); $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; @@ -176,6 +184,7 @@ print '<td align="right" colspan="2"><input type="submit" class="button" '.$opti print "</tr>\n"; $var=true; +// Output to file $var=!$var; print '<tr '.$bc[$var].'><td width="140"><input '.$bc[$var].' type="checkbox" name="SYSLOG_FILE_ON" '.$option.' value="1" '.($syslog_file_on?' checked="checked"':'').'> '.$langs->trans("SyslogSimpleFile").'</td>'; print '<td nowrap="nowrap">'.$langs->trans("SyslogFilename").': <input type="text" class="flat" name="filename" '.$option.' size="60" value="'.$defaultsyslogfile.'">'; @@ -183,6 +192,7 @@ print '</td>'; print "<td align=\"left\">".$form->textwithpicto('',$langs->trans("YouCanUseDOL_DATA_ROOT")); print '</td></tr>'; +// Output to syslog $var=!$var; print '<tr '.$bc[$var].'><td width="140"><input '.$bc[$var].' type="checkbox" name="SYSLOG_SYSLOG_ON" '.$option.' value="1" '.($syslog_syslog_on?' checked="checked"':'').'> '.$langs->trans("SyslogSyslog").'</td>'; print '<td nowrap="nowrap">'.$langs->trans("SyslogFacility").': <input type="text" class="flat" name="facility" '.$option.' value="'.$defaultsyslogfacility.'">'; @@ -190,6 +200,7 @@ print '</td>'; print "<td align=\"left\">".$form->textwithpicto('', $langs->trans('OnlyWindowsLOG_USER')); print '</td></tr>'; +// Output to Firebug try { set_include_path('/usr/share/php/'); @@ -214,6 +225,31 @@ catch(Exception $e) print '<!-- FirePHP no available into PHP -->'."\n"; } +// Output to Chrome +try +{ + set_include_path('/usr/share/php/'); + $res=@include_once 'ChromePhp.php'; + restore_include_path(); + if ($res) + { + $var=!$var; + print '<tr '.$bc[$var].'><td width="140"><input '.$bc[$var].' type="checkbox" name="SYSLOG_CHROMEPHP_ON" '.$option.' value="1" '; + if (! class_exists('ChromePHP')) print ' disabled="disabled"'; + else print ($syslog_chromephp_on?' checked="checked"':""); + print '> '.$langs->trans("ChromePHP").'</td>'; + print '<td nowrap="nowrap">'; + print '</td>'; + print "<td align=\"left\">".$form->textwithpicto('','ChromePHP must be installed onto PHP path and ChromePHP plugin for Chrome must also be installed'); + print '</td></tr>'; + } +} +catch(Exception $e) +{ + // Do nothing + print '<!-- ChromePHP no available into PHP -->'."\n"; +} + print "</table>\n"; print "</form>\n"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 790d8580b938d219728180ec4883c57f095c3c6a..cccc2429817822468949e4e0c3d419fb4c5cc206 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -570,7 +570,7 @@ function dol_syslog($message, $level=LOG_INFO) set_include_path('/usr/share/php/'); include_once 'FirePHPCore/FirePHP.class.php'; set_include_path($oldinclude); - ob_start(); + ob_start(); // To be sure headers are not flushed until all page is completely processed $firephp = FirePHP::getInstance(true); if ($level == LOG_ERR) $firephp->error($message); elseif ($level == LOG_WARNING) $firephp->warn($message); @@ -579,7 +579,29 @@ function dol_syslog($message, $level=LOG_INFO) } catch(Exception $e) { - // Do not use dol_syslog to avoid infinite loop + // Do not use dol_syslog here to avoid infinite loop + } + } + // Check if log is to syslog (SYSLOG_FIREPHP_ON defined) + if (defined("SYSLOG_CHROMEPHP_ON") && constant("SYSLOG_CHROMEPHP_ON") && ! empty($_SERVER["SERVER_NAME"])) //! empty($_SERVER["SERVER_NAME"]) to be sure to enable this in Web mode only + { + try + { + // Warning ChromePHP must be into PHP include path. It is not possible to use into require_once() a constant from + // database or config file because we must be able to log data before database or config file read. + $oldinclude=get_include_path(); + set_include_path('/usr/share/php/'); + include_once 'ChromePhp.php'; + set_include_path($oldinclude); + ob_start(); // To be sure headers are not flushed until all page is completely processed + if ($level == LOG_ERR) ChromePhp::error($message); + elseif ($level == LOG_WARNING) ChromePhp::warn($message); + elseif ($level == LOG_INFO) ChromePhp::log($message); + else ChromePhp::log($message); + } + catch(Exception $e) + { + // Do not use dol_syslog here to avoid infinite loop } } } diff --git a/htdocs/core/tpl/objectline_add.tpl.php b/htdocs/core/tpl/objectline_add.tpl.php index f07a23ab26a0d1e994c35fc0170f630f6411afe6..817878ee3baece51f7d86876ad4b16a58a7c6bf2 100644 --- a/htdocs/core/tpl/objectline_add.tpl.php +++ b/htdocs/core/tpl/objectline_add.tpl.php @@ -60,6 +60,7 @@ if (! empty($conf->margin->enabled)) { <form name="addproduct" id="addproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST"> <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> <input type="hidden" name="action" value="addline" /> +<input type="hidden" name="usenewaddlineform" value="1" /> <input type="hidden" name="id" value="<?php echo $this->id; ?>" /> <?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?> diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index ac0fe494e0ea3062992be36fed37139ea0fed805..c9487574121242c620391fa3b7c860b8eaa7ea68 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -30,6 +30,7 @@ <form action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'#'.$line->id; ?>" method="POST"> <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>"> <input type="hidden" name="action" value="updateligne"> +<input type="hidden" name="usenewupdatelineform" value="1" /> <input type="hidden" name="id" value="<?php echo $this->id; ?>"> <input type="hidden" name="lineid" value="<?php echo $line->id; ?>"> <input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>">