mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Added XDebug tools
This commit is contained in:
parent
33ad9283ae
commit
e83b22b29b
|
|
@ -33,34 +33,37 @@ function llxHeader($head = "", $urlp = "")
|
|||
|
||||
$langs->load("admin");
|
||||
|
||||
|
||||
|
||||
top_menu($head);
|
||||
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/admin/system/index.php", $langs->trans("Summary"));
|
||||
|
||||
|
||||
// Dolibarr
|
||||
$menu->add(DOL_URL_ROOT."/admin/system/dolibarr.php", "Dolibarr");
|
||||
$menu->add_submenu(DOL_URL_ROOT."/admin/system/constall.php", $langs->trans("AllParameters"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/admin/system/modules.php", $langs->trans("Modules"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/admin/triggers.php", $langs->trans("Triggers"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/about.php", $langs->trans("About"));
|
||||
|
||||
|
||||
// OS
|
||||
$menu->add(DOL_URL_ROOT."/admin/system/os.php", $langs->trans("OS"));
|
||||
|
||||
|
||||
// Web server
|
||||
$menu->add(DOL_URL_ROOT."/admin/system/web.php", $langs->trans("WebServer"));
|
||||
|
||||
|
||||
// PHP
|
||||
$menu->add(DOL_URL_ROOT."/admin/system/phpinfo.php", $langs->trans("Php"));
|
||||
|
||||
// Database
|
||||
|
||||
// XDebug
|
||||
//$menu->add(DOL_URL_ROOT."/admin/system/xdebug.php", $langs->trans("XDebug"));
|
||||
|
||||
// Database
|
||||
$menu->add(DOL_URL_ROOT."/admin/system/database.php", $langs->trans("Database"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/admin/system/database-tables.php", $langs->trans("Tables"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/admin/system/database-tables-contraintes.php", $langs->trans("Constraints"));
|
||||
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
|
||||
|
|
|
|||
71
htdocs/admin/system/xdebug.php
Normal file
71
htdocs/admin/system/xdebug.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/admin/system/xdebug.php
|
||||
\brief Page administration XDebug
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
print_fiche_titre("XDebug",'','setup');
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
if (!function_exists('xdebug_is_enabled'))
|
||||
{
|
||||
print 'XDebug seems to be not installed. Function xdebug_is_enabled not found.';
|
||||
llxfooter('$Date$ - $Revision$');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if (function_exists('socket_create'))
|
||||
{
|
||||
$address = '127.0.0.1';
|
||||
$port = 9000;
|
||||
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
|
||||
socket_bind($sock, $address, $port) or die('Unable to bind');
|
||||
socket_listen($sock);
|
||||
$client = socket_accept($sock);
|
||||
echo "connection established: $client";
|
||||
socket_close($client);
|
||||
socket_close($sock);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Can't test if PHPDebug is OK as PHP socket functions are not enabled.";
|
||||
}
|
||||
|
||||
|
||||
llxfooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
|
@ -1,8 +1,5 @@
|
|||
<?php
|
||||
<?php
|
||||
/* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -22,7 +19,7 @@
|
|||
/**
|
||||
\file htdocs/admin/tools/eaccelerator.php
|
||||
\brief Page administration de eaccelerator
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
|
@ -34,7 +31,7 @@ if (!$user->admin)
|
|||
|
||||
|
||||
/*
|
||||
* Affichage page
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
|
@ -100,13 +97,13 @@ function revcompare($x, $y)
|
|||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function create_script_table($list)
|
||||
{
|
||||
global $sortby,$bc,$langs;
|
||||
$var=true;
|
||||
|
||||
|
||||
if (isset($_GET['order']) && ($_GET['order'] == "asc" || $_GET['order'] =="desc")) {
|
||||
$order = $_GET['order'];
|
||||
} else {
|
||||
|
|
@ -149,7 +146,7 @@ function revcompare($x, $y)
|
|||
default:
|
||||
$sortby = "file";
|
||||
($order == "asc" ? uasort($list, 'compare') : uasort($list, 'revcompare'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
foreach($list as $script) { ?>
|
||||
|
|
@ -162,7 +159,7 @@ function revcompare($x, $y)
|
|||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -186,7 +183,7 @@ function create_key_table($list)
|
|||
<td><?php print dolibarr_trunc($key['name'],80,'left'); ?></td>
|
||||
<td align="center" nowrap="nowrap"><?php dolibarr_print_date($key['created'],'dayhour'); ?></td>
|
||||
<td align="right" nowrap="nowrap"><?php print number_format($key['size']/1024, 3); ?> KB</td>
|
||||
<td align="right" nowrap="nowrap"><?php
|
||||
<td align="right" nowrap="nowrap"><?php
|
||||
if ($key['ttl'] == -1) {
|
||||
print 'expired';
|
||||
} elseif ($key['ttl'] == 0) {
|
||||
|
|
@ -216,7 +213,7 @@ $var=true;
|
|||
<table class="noborder">
|
||||
<tr class="liste_titre"><td colspan="2">Information</td></tr>
|
||||
<tr <?php $var = ! $var; print $bc[$var]; ?>>
|
||||
<td>Caching enabled</td>
|
||||
<td>Caching enabled</td>
|
||||
<td align="right"><?php print $info['cache'] ? 'yes':'no' ?></td>
|
||||
</tr>
|
||||
<tr <?php $var = ! $var; print $bc[$var]; ?>>
|
||||
|
|
@ -225,7 +222,7 @@ $var=true;
|
|||
</tr>
|
||||
<tr <?php $var = ! $var; print $bc[$var]; ?>>
|
||||
<td>Memory usage</td>
|
||||
<td align="right"><?php print number_format(100 * $info['memoryAllocated'] / $info['memorySize'], 2); ?>%
|
||||
<td align="right"><?php print number_format(100 * $info['memoryAllocated'] / $info['memorySize'], 2); ?>%
|
||||
(<?php print number_format($info['memoryAllocated'] / (1024*1024), 2); ?> MB /
|
||||
<?php print number_format($info['memorySize'] / (1024*1024), 2); ?> MB)</td>
|
||||
</tr>
|
||||
|
|
@ -238,7 +235,7 @@ $var=true;
|
|||
<td align="right"><?php print $info['cachedScripts']; ?></td>
|
||||
</tr>
|
||||
<tr <?php $var = ! $var; print $bc[$var]; ?>>
|
||||
<td>Removed scripts</td>
|
||||
<td>Removed scripts</td>
|
||||
<td align="right"><?php print $info['removedScripts']; ?></td>
|
||||
</tr>
|
||||
<tr <?php $var = ! $var; print $bc[$var]; ?>>
|
||||
|
|
@ -287,7 +284,7 @@ $res=eaccelerator_cached_scripts(); // If success return an array
|
|||
if (is_array($res)) create_script_table($res);
|
||||
else print "Check in your <b>php.ini</b> that <b>eaccelerator.allowed_admin_path</b> parameter is "._FILE;
|
||||
?>
|
||||
|
||||
|
||||
<br><br>
|
||||
<b>Removed scripts</b><br>
|
||||
<table>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
||||
|
||||
$langs->load("commercial");
|
||||
$langs->load("orders");
|
||||
|
|
@ -202,7 +203,7 @@ $db->close();
|
|||
if ($langs->file_exists("html/spam.html",0)) {
|
||||
print "<br><br><br><br>".$langs->trans("Note")."<br>";
|
||||
print '<div style="padding: 4px; background: #FAFAFA; border: 1px solid #BBBBBB;" >';
|
||||
$langs->print_file("html/spam.html",0);
|
||||
dol_print_file($langs,"html/spam.html",0);
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
|
|
|||
|
|
@ -49,12 +49,12 @@ class Conf
|
|||
var $css; // Used to store current css (from theme)
|
||||
var $top_menu;
|
||||
var $left_menu;
|
||||
|
||||
|
||||
var $css_modules=array();
|
||||
var $tabs_modules=array();
|
||||
|
||||
|
||||
var $logbuffer=array();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Positionne toutes les variables de configuration
|
||||
|
|
@ -63,7 +63,7 @@ class Conf
|
|||
*/
|
||||
function setValues($db)
|
||||
{
|
||||
dolibarr_syslog("Conf::setValues");
|
||||
dol_syslog("Conf::setValues");
|
||||
|
||||
// Par defaut, a oui
|
||||
$this->global->PRODUIT_CONFIRM_DELETE_LINE=1;
|
||||
|
|
@ -79,7 +79,7 @@ class Conf
|
|||
{
|
||||
$numr = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
while ($i < $numr)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
|
@ -101,7 +101,7 @@ class Conf
|
|||
$this->tabs_modules[$params[0]][]=$value;
|
||||
//print 'xxx'.$params[0].'-'.$value;
|
||||
}
|
||||
// If this is a module constant
|
||||
// If this is a module constant
|
||||
if (eregi('^MAIN_MODULE_([A-Z]+)$',$key,$reg) && $value)
|
||||
{
|
||||
$module=strtolower($reg[1]);
|
||||
|
|
@ -114,7 +114,7 @@ class Conf
|
|||
}
|
||||
$db->free($result);
|
||||
|
||||
|
||||
|
||||
// On reprend parametres du fichier de config conf.php
|
||||
// \TODO Mettre tous les param de conf DB dans une propriete de la classe
|
||||
|
||||
|
|
@ -139,13 +139,13 @@ class Conf
|
|||
|
||||
// Other global parameters
|
||||
$this->users->dir_output=DOL_DATA_ROOT."/users";
|
||||
|
||||
|
||||
// For backward compatibility
|
||||
$this->comptaexpert->enabled=defined("MAIN_MODULE_COMPTABILITE_EXPERT")?MAIN_MODULE_COMPTABILITE_EXPERT:0;
|
||||
$this->compta->enabled=defined("MAIN_MODULE_COMPTABILITE")?MAIN_MODULE_COMPTABILITE:0;
|
||||
$this->webcal->enabled=defined('MAIN_MODULE_WEBCALENDAR')?MAIN_MODULE_WEBCALENDAR:0;
|
||||
$this->propal->enabled=defined("MAIN_MODULE_PROPALE")?MAIN_MODULE_PROPALE:0;
|
||||
|
||||
|
||||
// Module agenda
|
||||
$this->agenda->dir_temp=DOL_DATA_ROOT."/agenda/temp";
|
||||
|
||||
|
|
@ -214,7 +214,7 @@ class Conf
|
|||
// Module service
|
||||
$this->service->dir_output=DOL_DATA_ROOT."/produit";
|
||||
$this->service->dir_temp =DOL_DATA_ROOT."/produit/temp";
|
||||
|
||||
|
||||
// Module droipret
|
||||
$this->droitpret->cat=defined('DROITPRET_CAT')?DROITPRET_CAT:'';
|
||||
$this->droitpret->cat=defined('DROITPRET_MAIL')?DROITPRET_MAIL:'';
|
||||
|
|
@ -286,7 +286,7 @@ class Conf
|
|||
$this->boutique->album->enabled=defined("BOUTIQUE_ALBUM")?BOUTIQUE_ALBUM:0;
|
||||
// Module Barcode
|
||||
$this->barcode->dir_temp=DOL_DATA_ROOT."/barcode/temp";
|
||||
|
||||
|
||||
/*
|
||||
* Modification de quelques variable de conf en fonction des Constantes
|
||||
*/
|
||||
|
|
@ -305,7 +305,7 @@ class Conf
|
|||
// conf->box_max_lines
|
||||
$this->box_max_lines=5;
|
||||
if (isset($this->global->MAIN_BOXES_MAXLINES)) $this->box_max_lines=$this->global->MAIN_BOXES_MAXLINES;
|
||||
|
||||
|
||||
// conf->use_preview_tabs
|
||||
$this->use_preview_tabs=0;
|
||||
if (isset($this->global->MAIN_USE_PREVIEW_TABS)) $this->use_preview_tabs=$this->global->MAIN_USE_PREVIEW_TABS;
|
||||
|
|
@ -314,7 +314,7 @@ class Conf
|
|||
$this->use_javascript_ajax=1;
|
||||
if (isset($this->global->MAIN_DISABLE_JAVASCRIPT)) $this->use_javascript_ajax=! $this->global->MAIN_DISABLE_JAVASCRIPT;
|
||||
// If no javascript_ajax, Ajax features are disabled.
|
||||
if (! $this->use_javascript_ajax)
|
||||
if (! $this->use_javascript_ajax)
|
||||
{
|
||||
$this->global->PRODUIT_USE_SEARCH_TO_SELECT=0;
|
||||
$this->global->MAIN_CONFIRM_AJAX=0;
|
||||
|
|
@ -357,7 +357,7 @@ class Conf
|
|||
if (empty($this->global->MAIN_THEME)) $this->global->MAIN_THEME="eldy";
|
||||
$this->theme=$this->global->MAIN_THEME;
|
||||
$this->css = "theme/".$this->theme."/".$this->theme.".css";
|
||||
|
||||
|
||||
// $this->email_from = email pour envoi par dolibarr des mails automatiques
|
||||
$this->email_from = "dolibarr-robot@domain.com";
|
||||
if (! empty($this->global->MAIN_MAIL_EMAIL_FROM))
|
||||
|
|
@ -383,7 +383,7 @@ class Conf
|
|||
{
|
||||
$this->global->MAIN_GRAPH_LIBRARY = 'artichow';
|
||||
}
|
||||
|
||||
|
||||
// Format de la date
|
||||
// \todo Mettre les 4 formats dans fichier langue
|
||||
$this->format_date_short="%d/%m/%Y";
|
||||
|
|
@ -393,7 +393,7 @@ class Conf
|
|||
$this->format_date_hour_short="%d/%m/%Y %H:%M";
|
||||
$this->format_date_hour_text_short="%d %b %Y %H:%M";
|
||||
$this->format_date_hour_text="%d %B %Y %H:%M";
|
||||
|
||||
|
||||
$this->format_date_short_java="dd/MM/yyyy";
|
||||
|
||||
// Limites decimales si non definie (peuvent etre egale a 0)
|
||||
|
|
@ -403,7 +403,7 @@ class Conf
|
|||
|
||||
// Define umask
|
||||
if (empty($conf->global->MAIN_UMASK)) $conf->global->MAIN_UMASK='0664';
|
||||
|
||||
|
||||
/* \todo Ajouter une option Gestion de la TVA dans le module compta qui permet de desactiver la fonction TVA
|
||||
* (pour particuliers ou liberaux en franchise)
|
||||
* En attendant, valeur forcee a 1 car toujours interessant a avoir meme ceux qui veulent pas.
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ class MenuLeft {
|
|||
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/os.php", $langs->trans("OS"));
|
||||
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/web.php", $langs->trans("WebServer"));
|
||||
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/phpinfo.php", $langs->trans("Php"));
|
||||
//if ($leftmenu=="system" && function_exists('xdebug_is_enabled')) $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/xdebug.php", $langs->trans("XDebug"));
|
||||
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/database.php", $langs->trans("Database"));
|
||||
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/database-tables.php", $langs->trans("Tables"),2);
|
||||
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/database-tables-contraintes.php", $langs->trans("Constraints"),2);
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@ class MenuLeft {
|
|||
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/os.php", $langs->trans("OS"));
|
||||
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/web.php", $langs->trans("WebServer"));
|
||||
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/phpinfo.php", $langs->trans("Php"));
|
||||
//if ($leftmenu=="system" && function_exists('xdebug_is_enabled')) $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/xdebug.php", $langs->trans("XDebug"));
|
||||
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/database.php", $langs->trans("Database"));
|
||||
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/database-tables.php", $langs->trans("Tables"),2);
|
||||
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/database-tables-contraintes.php", $langs->trans("Constraints"),2);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
include_once("./inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
||||
|
||||
$setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:'auto');
|
||||
$langs->setDefaultLang($setuplang);
|
||||
|
|
@ -45,12 +46,12 @@ pHeader($langs->trans("License"),"fileconf");
|
|||
|
||||
|
||||
//print '<pre style="align: center; font-size: 12px">';
|
||||
$result=$langs->print_file("html/gpl.html",1);
|
||||
$result=dol_print_file($langs,"html/gpl.html",1);
|
||||
if (! $result)
|
||||
{
|
||||
print '<center>'."\n";
|
||||
print '<textarea readonly="1" rows="26" cols="80">';
|
||||
$result=$langs->print_file("html/gpl.txt",1);
|
||||
dol_print_file($langs,"html/gpl.txt",1);
|
||||
print '</textarea>';
|
||||
print '</center>'."\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='',$encodeto
|
|||
|| eregi('^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$',$time,$reg))
|
||||
{
|
||||
// This part of code should not be used.
|
||||
dolibarr_syslog("Functions.lib::dolibarr_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_WARNING);
|
||||
dol_syslog("Functions.lib::dolibarr_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_WARNING);
|
||||
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
|
||||
$syear = $reg[1];
|
||||
$smonth = $reg[2];
|
||||
|
|
@ -444,7 +444,7 @@ function dol_stringtotime($string)
|
|||
if (eregi('^([0-9]+)\/([0-9]+)\/([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?',$string,$reg))
|
||||
{
|
||||
// This part of code should not be used.
|
||||
dolibarr_syslog("Functions.lib::dol_stringtotime call to function with deprecated parameter", LOG_WARN);
|
||||
dol_syslog("Functions.lib::dol_stringtotime call to function with deprecated parameter", LOG_WARN);
|
||||
// Date est au format 'DD/MM/YY' ou 'DD/MM/YY HH:MM:SS'
|
||||
// Date est au format 'DD/MM/YYYY' ou 'DD/MM/YYYY HH:MM:SS'
|
||||
$sday = $reg[1];
|
||||
|
|
@ -1450,7 +1450,7 @@ function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='',
|
|||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("functions.lib::restrictedArea sql=".$sql, LOG_ERR);
|
||||
dol_syslog("functions.lib::restrictedArea sql=".$sql, LOG_ERR);
|
||||
accessforbidden();
|
||||
}
|
||||
}
|
||||
|
|
@ -1591,7 +1591,7 @@ function dol_print_error($db='',$error='')
|
|||
}
|
||||
}
|
||||
|
||||
dolibarr_syslog("Error ".$syslog, LOG_ERR);
|
||||
dol_syslog("Error ".$syslog, LOG_ERR);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1630,7 +1630,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite)
|
|||
// les noms de fichiers.
|
||||
if (eregi('^\.',$src_file) || eregi('\.\.',$src_file) || eregi('[<>|]',$src_file))
|
||||
{
|
||||
dolibarr_syslog("Refused to deliver file ".$src_file);
|
||||
dol_syslog("Refused to deliver file ".$src_file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -1639,7 +1639,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite)
|
|||
// les noms de fichiers.
|
||||
if (eregi('^\.',$dest_file) || eregi('\.\.',$dest_file) || eregi('[<>|]',$dest_file))
|
||||
{
|
||||
dolibarr_syslog("Refused to deliver file ".$dest_file);
|
||||
dol_syslog("Refused to deliver file ".$dest_file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -1648,7 +1648,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite)
|
|||
{
|
||||
if (file_exists($file_name))
|
||||
{
|
||||
dolibarr_syslog("Functions.lib::dol_move_uploaded_file File ".$file_name." already exists", LOG_WARNING);
|
||||
dol_syslog("Functions.lib::dol_move_uploaded_file File ".$file_name." already exists", LOG_WARNING);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
|
@ -1658,12 +1658,12 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite)
|
|||
if ($return)
|
||||
{
|
||||
if (! empty($conf->global->MAIN_UMASK)) @chmod($file_name, octdec($conf->global->MAIN_UMASK));
|
||||
dolibarr_syslog("Functions.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".$conf->global->MAIN_UMASK, LOG_DEBUG);
|
||||
dol_syslog("Functions.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".$conf->global->MAIN_UMASK, LOG_DEBUG);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Functions.lib::dol_move_uploaded_file Failed to move ".$src_file." to ".$file_name, LOG_ERR);
|
||||
dol_syslog("Functions.lib::dol_move_uploaded_file Failed to move ".$src_file." to ".$file_name, LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
|
@ -1898,8 +1898,8 @@ function dol_delete_file($file)
|
|||
foreach (glob($file) as $filename)
|
||||
{
|
||||
$ok=unlink($filename);
|
||||
if ($ok) dolibarr_syslog("Removed file $filename",LOG_DEBUG);
|
||||
else dolibarr_syslog("Failed to remove file $filename",LOG_ERR);
|
||||
if ($ok) dol_syslog("Removed file $filename",LOG_DEBUG);
|
||||
else dol_syslog("Failed to remove file $filename",LOG_ERR);
|
||||
}
|
||||
return $ok;
|
||||
}
|
||||
|
|
@ -2157,7 +2157,7 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $taux_produit, $
|
|||
if (!is_object($societe_vendeuse)) return -1;
|
||||
if (!is_object($societe_acheteuse)) return -1;
|
||||
|
||||
dolibarr_syslog("get_default_tva vendeur_assujeti=".$societe_vendeuse->tva_assuj." pays_vendeur=".$societe_vendeuse->pays_code.", seller in cee=".$societe_vendeuse->isInEEC().", pays_acheteur=".$societe_acheteuse->pays_code.", buyer in cee=".$societe_acheteuse->isInEEC().", taux_produit(deprecated)=".$taux_produit.", idprod=".$idprod);
|
||||
dol_syslog("get_default_tva vendeur_assujeti=".$societe_vendeuse->tva_assuj." pays_vendeur=".$societe_vendeuse->pays_code.", seller in cee=".$societe_vendeuse->isInEEC().", pays_acheteur=".$societe_acheteuse->pays_code.", buyer in cee=".$societe_acheteuse->isInEEC().", taux_produit(deprecated)=".$taux_produit.", idprod=".$idprod);
|
||||
|
||||
// Si vendeur non assujeti a TVA (tva_assuj vaut 0/1 ou franchise/reel)
|
||||
if (is_numeric($societe_vendeuse->tva_assuj) && ! $societe_vendeuse->tva_assuj) return 0;
|
||||
|
|
@ -2267,7 +2267,7 @@ function create_exdir($dir)
|
|||
{
|
||||
global $conf;
|
||||
|
||||
dolibarr_syslog("functions.lib::create_exdir: dir=".$dir,LOG_INFO);
|
||||
dol_syslog("functions.lib::create_exdir: dir=".$dir,LOG_INFO);
|
||||
|
||||
if (@is_dir($dir)) return 0;
|
||||
|
||||
|
|
@ -2288,7 +2288,7 @@ function create_exdir($dir)
|
|||
{
|
||||
if (! @is_dir($ccdir))
|
||||
{
|
||||
dolibarr_syslog("functions.lib::create_exdir: Directory '".$ccdir."' does not exists or is outside open_basedir PHP setting.",LOG_DEBUG);
|
||||
dol_syslog("functions.lib::create_exdir: Directory '".$ccdir."' does not exists or is outside open_basedir PHP setting.",LOG_DEBUG);
|
||||
|
||||
umask(0);
|
||||
$dirmaskdec=octdec('0755');
|
||||
|
|
@ -2297,12 +2297,12 @@ function create_exdir($dir)
|
|||
if (! @mkdir($ccdir, $dirmaskdec))
|
||||
{
|
||||
// Si le is_dir a renvoye une fausse info, alors on passe ici.
|
||||
dolibarr_syslog("functions.lib::create_exdir: Fails to create directory '".$ccdir."' or directory already exists.",LOG_WARNING);
|
||||
dol_syslog("functions.lib::create_exdir: Fails to create directory '".$ccdir."' or directory already exists.",LOG_WARNING);
|
||||
$nberr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("functions.lib::create_exdir: Directory '".$ccdir."' created",LOG_DEBUG);
|
||||
dol_syslog("functions.lib::create_exdir: Directory '".$ccdir."' created",LOG_DEBUG);
|
||||
$nberr=0; // On remet a zero car si on arrive ici, cela veut dire que les <20>checs pr<70>c<EFBFBD>dents peuvent etre ignor<6F>s
|
||||
$nbcreated++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,54 @@
|
|||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoi le fichier $filename dans la version de la langue courante, sinon alternative
|
||||
* \param filename nom du fichier a rechercher
|
||||
* \param searchalt cherche aussi dans langue alternative
|
||||
* \return boolean
|
||||
*/
|
||||
function dol_print_file($langs,$filename,$searchalt=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Test if file is in lang directory
|
||||
foreach($langs->dir as $searchdir)
|
||||
{
|
||||
$htmlfile=($searchdir."/langs/".$langs->defaultlang."/".$filename);
|
||||
dol_syslog('Translate::print_file search file '.$htmlfile, LOG_DEBUG);
|
||||
if (is_readable($htmlfile))
|
||||
{
|
||||
$content=file_get_contents($htmlfile);
|
||||
$isutf8=utf8_check($content);
|
||||
if (! $isutf8 && $conf->character_set_client == 'UTF-8') print utf8_encode($content);
|
||||
elseif ($isutf8 && $conf->character_set_client == 'ISO-8859-1') print utf8_decode($content);
|
||||
else print $content;
|
||||
return true;
|
||||
}
|
||||
else dol_syslog('Translate::print_file not found', LOG_DEBUG);
|
||||
|
||||
if ($searchalt) {
|
||||
// Test si fichier dans repertoire de la langue alternative
|
||||
if ($langs->defaultlang != "en_US") $htmlfilealt = $searchdir."/langs/en_US/".$filename;
|
||||
else $htmlfilealt = $searchdir."/langs/fr_FR/".$filename;
|
||||
dol_syslog('Translate::print_file search alt file '.$htmlfilealt, LOG_DEBUG);
|
||||
//print 'getcwd='.getcwd().' htmlfilealt='.$htmlfilealt.' X '.file_exists(getcwd().'/'.$htmlfilealt);
|
||||
if (is_readable($htmlfilealt))
|
||||
{
|
||||
$content=file_get_contents($htmlfilealt);
|
||||
$isutf8=utf8_check($content);
|
||||
if (! $isutf8 && $conf->character_set_client == 'UTF-8') print utf8_encode($content);
|
||||
elseif ($isutf8 && $conf->character_set_client == 'ISO-8859-1') print utf8_decode($content);
|
||||
else print $content;
|
||||
return true;
|
||||
}
|
||||
else dol_syslog('Translate::print_file not found', LOG_DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Show informations on an object
|
||||
* \param object Objet to show
|
||||
|
|
@ -155,7 +203,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$valueforccc='',$date=
|
|||
{
|
||||
// Clean parameters
|
||||
if ($date == '') $date=mktime(); // We use local year and month of PHP server to search numbers
|
||||
// but we should use local year and month of user
|
||||
// but we should use local year and month of user
|
||||
|
||||
// Extract value for mask counter, mask raz and mask offset
|
||||
if (! eregi('\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}',$mask,$reg)) return 'ErrorBadMask';
|
||||
|
|
@ -261,7 +309,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$valueforccc='',$date=
|
|||
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||
|
||||
//print $sql;
|
||||
dolibarr_syslog("functions2::get_next_value sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("functions2::get_next_value sql=".$sql, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
|
@ -304,7 +352,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$valueforccc='',$date=
|
|||
if ($sqlwhere) $maskrefclient_sql.=' AND '.$sqlwhere; //use the same sqlwhere as general mask
|
||||
$maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')";
|
||||
|
||||
dolibarr_syslog("functions2::get_next_value maskrefclient_sql=".$maskrefclient_sql, LOG_DEBUG);
|
||||
dol_syslog("functions2::get_next_value maskrefclient_sql=".$maskrefclient_sql, LOG_DEBUG);
|
||||
$maskrefclient_resql=$db->query($maskrefclient_sql);
|
||||
if ($maskrefclient_resql)
|
||||
{
|
||||
|
|
@ -342,7 +390,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$valueforccc='',$date=
|
|||
$numFinal = str_replace($maskrefclient_maskbefore,$maskrefclient_maskafter,$numFinal);
|
||||
}
|
||||
|
||||
dolibarr_syslog("functions2::get_next_value return ".$numFinal,LOG_DEBUG);
|
||||
dol_syslog("functions2::get_next_value return ".$numFinal,LOG_DEBUG);
|
||||
return $numFinal;
|
||||
}
|
||||
|
||||
|
|
@ -438,7 +486,7 @@ function check_value($mask,$value)
|
|||
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",strlen($maskrefclient),"_"),$maskLike);
|
||||
|
||||
|
||||
dolibarr_syslog("functions2::check_value result=".$result,LOG_DEBUG);
|
||||
dol_syslog("functions2::check_value result=".$result,LOG_DEBUG);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
@ -607,15 +655,15 @@ function weight_convert($weight,&$from_unit,$to_unit)
|
|||
{
|
||||
if ($from_unit > $to_unit)
|
||||
{
|
||||
$weight = $weight * 10;
|
||||
$from_unit = $from_unit - 1;
|
||||
$weight = weight_convert($weight,$from_unit, $to_unit);
|
||||
$weight = $weight * 10;
|
||||
$from_unit = $from_unit - 1;
|
||||
$weight = weight_convert($weight,$from_unit, $to_unit);
|
||||
}
|
||||
if ($from_unit < $to_unit)
|
||||
{
|
||||
$weight = $weight / 10;
|
||||
$from_unit = $from_unit + 1;
|
||||
$weight = weight_convert($weight,$from_unit, $to_unit);
|
||||
$weight = $weight / 10;
|
||||
$from_unit = $from_unit + 1;
|
||||
$weight = weight_convert($weight,$from_unit, $to_unit);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -649,7 +697,7 @@ function dol_set_user_param($db, &$user, $tab)
|
|||
$i++;
|
||||
}
|
||||
$sql.= ")";
|
||||
dolibarr_syslog("functions2.lib::dol_set_user_param sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("functions2.lib::dol_set_user_param sql=".$sql, LOG_DEBUG);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql)
|
||||
|
|
@ -667,7 +715,7 @@ function dol_set_user_param($db, &$user, $tab)
|
|||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."user_param(fk_user,param,value)";
|
||||
$sql.= " VALUES (".$user->id.",";
|
||||
$sql.= " '".$key."','".addslashes($value)."');";
|
||||
dolibarr_syslog("functions2.lib::dol_set_user_param sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("functions2.lib::dol_set_user_param sql=".$sql, LOG_DEBUG);
|
||||
|
||||
$result=$db->query($sql);
|
||||
if (! $result)
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ if ($conf->main_force_https)
|
|||
{
|
||||
$newurl=eregi_replace('^http:','https:',$_SERVER["SCRIPT_URI"]);
|
||||
|
||||
dolibarr_syslog("dolibarr_main_force_https is on, we make a redirect to ".$newurl,LOG_DEBUG);
|
||||
dol_syslog("dolibarr_main_force_https is on, we make a redirect to ".$newurl,LOG_DEBUG);
|
||||
header("Location: ".$newurl);
|
||||
exit;
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ if ($conf->main_force_https)
|
|||
|
||||
$newurl='https://'.$domaineport.$_SERVER["REQUEST_URI"];
|
||||
//print 'eee'.$newurl; exit;
|
||||
dolibarr_syslog("dolibarr_main_force_https is on, we make a redirect to ".$newurl,LOG_DEBUG);
|
||||
dol_syslog("dolibarr_main_force_https is on, we make a redirect to ".$newurl,LOG_DEBUG);
|
||||
header("Location: ".$newurl);
|
||||
exit;
|
||||
}
|
||||
|
|
@ -157,7 +157,7 @@ $sessionname="DOLSESSID_".$dolibarr_main_db_name;
|
|||
if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) ini_set('session.gc_maxlifetime',$conf->global->MAIN_SESSION_TIMEOUT);
|
||||
session_name($sessionname);
|
||||
session_start();
|
||||
dolibarr_syslog("Start session name=".$sessionname." Session id()=".session_id().", _SESSION['dol_login']=".(isset($_SESSION["dol_login"])?$_SESSION["dol_login"]:'').", ".ini_get("session.gc_maxlifetime"));
|
||||
dol_syslog("Start session name=".$sessionname." Session id()=".session_id().", _SESSION['dol_login']=".(isset($_SESSION["dol_login"])?$_SESSION["dol_login"]:'').", ".ini_get("session.gc_maxlifetime"));
|
||||
|
||||
// Disable modules (this must be after session_start)
|
||||
if (! empty($_REQUEST["disablemodules"])) $_SESSION["disablemodules"]=$_REQUEST["disablemodules"];
|
||||
|
|
@ -192,7 +192,7 @@ $authmode=split(',',$dolibarr_main_authentication);
|
|||
if (! sizeof($authmode))
|
||||
{
|
||||
$langs->load('main');
|
||||
dolibarr_print_error('',$langs->trans("ErrorConfigParameterNotDefined",'dolibarr_main_authentication'));
|
||||
dol_print_error('',$langs->trans("ErrorConfigParameterNotDefined",'dolibarr_main_authentication'));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
@ -218,7 +218,7 @@ if (! isset($_SESSION["dol_login"]))
|
|||
// Verifie code
|
||||
if (! $object->check('dol_antispam_value',$_POST['code'],true))
|
||||
{
|
||||
dolibarr_syslog('Bad value for code, connexion refused');
|
||||
dol_syslog('Bad value for code, connexion refused');
|
||||
$langs->load('main');
|
||||
$langs->load('other');
|
||||
|
||||
|
|
@ -265,7 +265,7 @@ if (! isset($_SESSION["dol_login"]))
|
|||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Authentification ko - failed to load file '".$authfile."'",LOG_ERR);
|
||||
dol_syslog("Authentification ko - failed to load file '".$authfile."'",LOG_ERR);
|
||||
sleep(1);
|
||||
$langs->load('main');
|
||||
$langs->load('other');
|
||||
|
|
@ -276,7 +276,7 @@ if (! isset($_SESSION["dol_login"]))
|
|||
|
||||
if (! $login)
|
||||
{
|
||||
dolibarr_syslog('Bad password, connexion refused',LOG_DEBUG);
|
||||
dol_syslog('Bad password, connexion refused',LOG_DEBUG);
|
||||
$langs->load('main');
|
||||
$langs->load('other');
|
||||
|
||||
|
|
@ -305,7 +305,7 @@ if (! isset($_SESSION["dol_login"]))
|
|||
$resultFetchUser=$user->fetch($login);
|
||||
if ($resultFetchUser <= 0)
|
||||
{
|
||||
dolibarr_syslog('User not found, connexion refused');
|
||||
dol_syslog('User not found, connexion refused');
|
||||
session_destroy();
|
||||
session_name($sessionname);
|
||||
session_start();
|
||||
|
|
@ -342,11 +342,11 @@ else
|
|||
$login=$_SESSION["dol_login"];
|
||||
$resultFetchUser=$user->fetch($login);
|
||||
|
||||
dolibarr_syslog("This is an already logged session. _SESSION['dol_login']=".$login);
|
||||
dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login);
|
||||
if ($resultFetchUser <= 0)
|
||||
{
|
||||
// Account has been removed after login
|
||||
dolibarr_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING);
|
||||
dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING);
|
||||
session_destroy();
|
||||
session_name($sessionname);
|
||||
session_start();
|
||||
|
|
@ -385,7 +385,7 @@ if (! isset($_SESSION["dol_login"]))
|
|||
// Nouvelle session pour ce login
|
||||
$_SESSION["dol_login"]=$user->login;
|
||||
$_SESSION["dol_authmode"]=$conf->authmode;
|
||||
dolibarr_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"].' Session id='.session_id());
|
||||
dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"].' Session id='.session_id());
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
|
@ -402,7 +402,7 @@ if (! isset($_SESSION["dol_login"]))
|
|||
{
|
||||
$db->rollback();
|
||||
session_destroy();
|
||||
dolibarr_print_error($db,'Error in some triggers on action USER_LOGIN',LOG_ERR);
|
||||
dol_print_error($db,'Error in some triggers on action USER_LOGIN',LOG_ERR);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
|
|
@ -543,7 +543,7 @@ if ($conf->global->MAIN_NEED_SMARTY)
|
|||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error('',"Library Smarty ".$smarty_libs." not found. Check parameter dolibarr_smarty_libs_dir in conf file.");
|
||||
dol_print_error('',"Library Smarty ".$smarty_libs." not found. Check parameter dolibarr_smarty_libs_dir in conf file.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -556,13 +556,13 @@ if ($user->statut < 1)
|
|||
{
|
||||
// Si non actif, on delogue le user
|
||||
$langs->load("other");
|
||||
dolibarr_syslog ("Authentification ko car login desactive");
|
||||
dol_syslog ("Authentification ko car login desactive");
|
||||
accessforbidden($langs->trans("ErrorLoginDisabled"));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
dolibarr_syslog("Access to ".$_SERVER["PHP_SELF"],LOG_INFO);
|
||||
dol_syslog("Access to ".$_SERVER["PHP_SELF"],LOG_INFO);
|
||||
|
||||
// For backward compatibility
|
||||
if (! defined('MAIN_INFO_SOCIETE_PAYS')) define('MAIN_INFO_SOCIETE_PAYS','1');
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ if (! defined('NOREQUIREDB'))
|
|||
|
||||
if ($db->error)
|
||||
{
|
||||
dolibarr_print_error($db,"host=".$conf->db->host.", port=".$conf->db->port.", user=".$conf->db->user.", databasename=".$conf->db->name.", ".$db->error);
|
||||
dol_print_error($db,"host=".$conf->db->host.", port=".$conf->db->port.", user=".$conf->db->user.", databasename=".$conf->db->name.", ".$db->error);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
@ -272,7 +272,7 @@ if (! defined('NOREQUIRESOC'))
|
|||
$mysoc->pays_code=$obj->code;
|
||||
}
|
||||
else {
|
||||
dolibarr_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
// Si dans MAIN_INFO_SOCIETE_PAYS on a deja un code, tout est fait
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class Translate {
|
|||
*/
|
||||
function setDefaultLang($srclang='fr_FR')
|
||||
{
|
||||
//dolibarr_syslog("Translate::setDefaultLang ".$this->defaultlang,LOG_DEBUG);
|
||||
//dol_syslog("Translate::setDefaultLang ".$this->defaultlang,LOG_DEBUG);
|
||||
|
||||
$this->origlang=$srclang;
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ class Translate {
|
|||
*/
|
||||
function setPhpLang()
|
||||
{
|
||||
//dolibarr_syslog("Translate::setPhpLang ".$this->defaultlang,LOG_DEBUG);
|
||||
//dol_syslog("Translate::setPhpLang ".$this->defaultlang,LOG_DEBUG);
|
||||
return;
|
||||
/*
|
||||
$code_lang_tiret=ereg_replace('_','-',$this->defaultlang);
|
||||
|
|
@ -177,12 +177,12 @@ class Translate {
|
|||
*/
|
||||
function Load($domain,$alt=0)
|
||||
{
|
||||
//dolibarr_syslog("Translate::Load domain=".$domain." alt=".$alt);
|
||||
//dol_syslog("Translate::Load domain=".$domain." alt=".$alt);
|
||||
|
||||
// Check parameters
|
||||
if (empty($domain))
|
||||
{
|
||||
dolibarr_print_error('',"Translate::Load ErrorWrongParameters");
|
||||
dol_print_error('',"Translate::Load ErrorWrongParameters");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
@ -285,7 +285,7 @@ class Translate {
|
|||
if (! $newalt && $this->defaultlang != "fr_FR" && $this->defaultlang != "en_US")
|
||||
{
|
||||
// This function must not contains call to syslog
|
||||
dolibarr_syslog("Translate::Load loading alternate translation file (to complete ".$this->defaultlang."/".$domain.".lang file)", LOG_DEBUG);
|
||||
dol_print_error("Translate::Load loading alternate translation file (to complete ".$this->defaultlang."/".$domain.".lang file)", LOG_DEBUG);
|
||||
$this->load($domain,1);
|
||||
}
|
||||
|
||||
|
|
@ -312,7 +312,7 @@ class Translate {
|
|||
*/
|
||||
function UnLoad($domain)
|
||||
{
|
||||
dolibarr_syslog("Translate::UnLoad domain=".$domain." marked as not loaded", LOG_DEBUG);
|
||||
dol_syslog("Translate::UnLoad domain=".$domain." marked as not loaded", LOG_DEBUG);
|
||||
$this->tab_loaded[$domain]=0;
|
||||
}
|
||||
|
||||
|
|
@ -530,54 +530,6 @@ class Translate {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoi le fichier $filename dans la version de la langue courante, sinon alternative
|
||||
* \param filename nom du fichier a rechercher
|
||||
* \param searchalt cherche aussi dans langue alternative
|
||||
* \return boolean
|
||||
*/
|
||||
function print_file($filename,$searchalt=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Test if file is in lang directory
|
||||
foreach($this->dir as $searchdir)
|
||||
{
|
||||
$htmlfile=($searchdir."/langs/".$this->defaultlang."/".$filename);
|
||||
dolibarr_syslog('Translate::print_file search file '.$htmlfile, LOG_DEBUG);
|
||||
if (is_readable($htmlfile))
|
||||
{
|
||||
$content=file_get_contents($htmlfile);
|
||||
$isutf8=utf8_check($content);
|
||||
if (! $isutf8 && $conf->character_set_client == 'UTF-8') print utf8_encode($content);
|
||||
elseif ($isutf8 && $conf->character_set_client == 'ISO-8859-1') print utf8_decode($content);
|
||||
else print $content;
|
||||
return true;
|
||||
}
|
||||
else dolibarr_syslog('Translate::print_file not found', LOG_DEBUG);
|
||||
|
||||
if ($searchalt) {
|
||||
// Test si fichier dans repertoire de la langue alternative
|
||||
if ($this->defaultlang != "en_US") $htmlfilealt = $searchdir."/langs/en_US/".$filename;
|
||||
else $htmlfilealt = $searchdir."/langs/fr_FR/".$filename;
|
||||
dolibarr_syslog('Translate::print_file search alt file '.$htmlfilealt, LOG_DEBUG);
|
||||
//print 'getcwd='.getcwd().' htmlfilealt='.$htmlfilealt.' X '.file_exists(getcwd().'/'.$htmlfilealt);
|
||||
if (is_readable($htmlfilealt))
|
||||
{
|
||||
$content=file_get_contents($htmlfilealt);
|
||||
$isutf8=utf8_check($content);
|
||||
if (! $isutf8 && $conf->character_set_client == 'UTF-8') print utf8_encode($content);
|
||||
elseif ($isutf8 && $conf->character_set_client == 'ISO-8859-1') print utf8_decode($content);
|
||||
else print $content;
|
||||
return true;
|
||||
}
|
||||
else dolibarr_syslog('Translate::print_file not found', LOG_DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return a label for a key. Store key-label in a cache.
|
||||
* \param db Database handler
|
||||
|
|
@ -609,7 +561,7 @@ class Translate {
|
|||
$sql = "SELECT ".$fieldlabel." as label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$tablename;
|
||||
$sql.= " WHERE ".$fieldkey." = '".$key."'";
|
||||
dolibarr_syslog('Translate::getLabelFromKey sql='.$sql,LOG_DEBUG);
|
||||
dol_syslog('Translate::getLabelFromKey sql='.$sql,LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
|
@ -622,7 +574,7 @@ class Translate {
|
|||
else
|
||||
{
|
||||
$this->error=$db->lasterror();
|
||||
dolibarr_syslog("Translate::getLabelFromKey error=".$this->error,LOG_ERR);
|
||||
dol_syslog("Translate::getLabelFromKey error=".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user