Skip to content
Snippets Groups Projects
Commit e6f35998 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Qual: Some code cleaning

parent 91a1c903
No related branches found
No related tags found
No related merge requests found
...@@ -54,11 +54,7 @@ llxHeader(); ...@@ -54,11 +54,7 @@ llxHeader();
$form = new Form($db); $form = new Form($db);
// If lib forced $datetime = dol_now();
if (! empty($_GET["lib"])) $conf->global->MAIN_GRAPH_LIBRARY=$_GET["lib"];
$datetime = time();
$year = dol_print_date($datetime, "%Y"); $year = dol_print_date($datetime, "%Y");
$month = dol_print_date($datetime, "%m"); $month = dol_print_date($datetime, "%m");
$day = dol_print_date($datetime, "%d"); $day = dol_print_date($datetime, "%d");
......
...@@ -255,15 +255,15 @@ class Conf ...@@ -255,15 +255,15 @@ class Conf
$this->$module->dir_temp=$rootfordata."/".$module."/temp"; $this->$module->dir_temp=$rootfordata."/".$module."/temp";
} }
// For mycompany setup // For mycompany storage
$this->mycompany->dir_output=$rootfordata."/mycompany"; $this->mycompany->dir_output=$rootfordata."/mycompany";
$this->mycompany->dir_temp=$rootfordata."/mycompany/temp"; $this->mycompany->dir_temp=$rootfordata."/mycompany/temp";
// For admin features // For admin storage
$this->admin->dir_output=$rootfordata.'/admin'; $this->admin->dir_output=$rootfordata.'/admin';
$this->admin->dir_temp=$rootfordata.'/admin/temp'; $this->admin->dir_temp=$rootfordata.'/admin/temp';
// Module user // For user storage
$this->user->dir_output=$rootforuser."/users"; $this->user->dir_output=$rootforuser."/users";
$this->user->dir_temp=$rootforuser."/users/temp"; $this->user->dir_temp=$rootforuser."/users/temp";
...@@ -309,10 +309,7 @@ class Conf ...@@ -309,10 +309,7 @@ class Conf
$this->use_javascript_ajax=1; $this->use_javascript_ajax=1;
if (isset($this->global->MAIN_DISABLE_JAVASCRIPT)) $this->use_javascript_ajax=! $this->global->MAIN_DISABLE_JAVASCRIPT; 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 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->PRODUIT_USE_SEARCH_TO_SELECT=0;
}
// conf->currency // conf->currency
if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR'; if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR';
...@@ -346,9 +343,6 @@ class Conf ...@@ -346,9 +343,6 @@ class Conf
$this->mailing->email_from=$this->email_from; $this->mailing->email_from=$this->email_from;
if (! empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from=$this->global->MAILING_EMAIL_FROM; if (! empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from=$this->global->MAILING_EMAIL_FROM;
// Defini MAIN_GRAPH_LIBRARY
if (empty($this->global->MAIN_GRAPH_LIBRARY)) $this->global->MAIN_GRAPH_LIBRARY = 'artichow';
if (! isset($this->global->FCKEDITOR_EDITORNAME)) $this->global->FCKEDITOR_EDITORNAME='ckeditor'; // fckeditor to switch if (! isset($this->global->FCKEDITOR_EDITORNAME)) $this->global->FCKEDITOR_EDITORNAME='ckeditor'; // fckeditor to switch
// Format for date (used by default when not found or searched in lang) // Format for date (used by default when not found or searched in lang)
......
...@@ -69,7 +69,7 @@ class DolGraph ...@@ -69,7 +69,7 @@ class DolGraph
var $graph; // Objet Graph (Artichow, Phplot...) var $graph; // Objet Graph (Artichow, Phplot...)
var $error; var $error;
var $library=''; // Par defaut on utiliser PHPlot var $library='artichow'; // Graphic library to use
var $bordercolor; // array(R,G,B) var $bordercolor; // array(R,G,B)
var $bgcolor; // array(R,G,B) var $bgcolor; // array(R,G,B)
...@@ -85,7 +85,6 @@ class DolGraph ...@@ -85,7 +85,6 @@ class DolGraph
global $conf; global $conf;
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
// Test si module GD present // Test si module GD present
$modules_list = get_loaded_extensions(); $modules_list = get_loaded_extensions();
$isgdinstalled=0; $isgdinstalled=0;
...@@ -99,15 +98,11 @@ class DolGraph ...@@ -99,15 +98,11 @@ class DolGraph
return -1; return -1;
} }
// Defini proprietes de l'objet graphe
$this->library=$conf->global->MAIN_GRAPH_LIBRARY;
$this->bordercolor = array(235,235,224); $this->bordercolor = array(235,235,224);
$this->datacolor = array(array(120,130,150), array(160,160,180), array(190,190,220)); $this->datacolor = array(array(120,130,150), array(160,160,180), array(190,190,220));
$this->bgcolor = array(235,235,224); $this->bgcolor = array(235,235,224);
$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php"; $color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/graph-color.php';
if (is_readable($color_file)) if (is_readable($color_file))
{ {
include_once($color_file); include_once($color_file);
......
...@@ -386,7 +386,6 @@ function build_rssfile($format,$title,$desc,$events_array,$outputfile,$filter='' ...@@ -386,7 +386,6 @@ function build_rssfile($format,$title,$desc,$events_array,$outputfile,$filter=''
/** /**
* Encode for cal export * Encode for cal export
* string must be encoded in conf->file->character_set_client
* *
* @param string $format vcal or ical * @param string $format vcal or ical
* @param string $string string to encode * @param string $string string to encode
...@@ -396,10 +395,8 @@ function format_cal($format,$string) ...@@ -396,10 +395,8 @@ function format_cal($format,$string)
{ {
global $conf; global $conf;
if ($conf->file->character_set_client == 'ISO-8859-1') $newstring=utf8_encode($string); $newstring=$string;
else $newstring=$string;
// Now newstring is always UTF8 string
if ($format == 'vcal') if ($format == 'vcal')
{ {
$newstring=quotedPrintEncode($newstring); $newstring=quotedPrintEncode($newstring);
......
...@@ -197,10 +197,6 @@ if ($action == "set") ...@@ -197,10 +197,6 @@ if ($action == "set")
//print "<tr><td>Creation de la table $name/td>"; //print "<tr><td>Creation de la table $name/td>";
$requestnb++; $requestnb++;
if ($conf->file->character_set_client == "UTF-8")
{
$buffer=utf8_encode($buffer);
}
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG); dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);
$resql=$db->query($buffer,0,'dml'); $resql=$db->query($buffer,0,'dml');
...@@ -344,10 +340,6 @@ if ($action == "set") ...@@ -344,10 +340,6 @@ if ($action == "set")
//print "<tr><td>Creation des cles et index de la table $name: '$buffer'</td>"; //print "<tr><td>Creation des cles et index de la table $name: '$buffer'</td>";
$requestnb++; $requestnb++;
if ($conf->file->character_set_client == "UTF-8")
{
$buffer=utf8_encode($buffer);
}
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG); dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);
$resql=$db->query($buffer,0,'dml'); $resql=$db->query($buffer,0,'dml');
......
...@@ -56,16 +56,12 @@ $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption; ...@@ -56,16 +56,12 @@ $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;
$conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
$conf->file->main_limit_users = $dolibarr_main_limit_users; $conf->file->main_limit_users = $dolibarr_main_limit_users;
$conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb; $conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb;
if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE'); // For test purpose // Identification mode
// Identifiant autres
$conf->file->main_authentication = empty($dolibarr_main_authentication)?'':$dolibarr_main_authentication; $conf->file->main_authentication = empty($dolibarr_main_authentication)?'':$dolibarr_main_authentication;
// Force https // Force https
$conf->file->main_force_https = empty($dolibarr_main_force_https)?'':$dolibarr_main_force_https; $conf->file->main_force_https = empty($dolibarr_main_force_https)?'':$dolibarr_main_force_https;
// Define charset for HTML Output (can set hidden value force_charset in conf file)
$conf->file->character_set_client = strtoupper($force_charset_do_notuse);
// Cookie cryptkey // Cookie cryptkey
$conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey)?'':$dolibarr_main_cookie_cryptkey; $conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey)?'':$dolibarr_main_cookie_cryptkey;
// Define array of document root directories // Define array of document root directories
$conf->file->dol_document_root = array('main' => DOL_DOCUMENT_ROOT); $conf->file->dol_document_root = array('main' => DOL_DOCUMENT_ROOT);
if (! empty($dolibarr_main_document_root_alt)) if (! empty($dolibarr_main_document_root_alt))
...@@ -77,6 +73,8 @@ if (! empty($dolibarr_main_document_root_alt)) ...@@ -77,6 +73,8 @@ if (! empty($dolibarr_main_document_root_alt))
$conf->file->dol_document_root['alt']=$value; $conf->file->dol_document_root['alt']=$value;
} }
} }
// Force db type (for test purpose)
if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE');
// Multi-Company transverse mode // Multi-Company transverse mode
$conf->multicompany->transverse_mode = empty($multicompany_transverse_mode)?'':$multicompany_transverse_mode; $conf->multicompany->transverse_mode = empty($multicompany_transverse_mode)?'':$multicompany_transverse_mode;
...@@ -91,7 +89,7 @@ if (! defined('NOREQUIRESOC')) require_once(DOL_DOCUMENT_ROOT ."/societe/class/ ...@@ -91,7 +89,7 @@ if (! defined('NOREQUIRESOC')) require_once(DOL_DOCUMENT_ROOT ."/societe/class/
*/ */
if (! defined('NOREQUIRETRAN')) if (! defined('NOREQUIRETRAN'))
{ {
$langs = new Translate("",$conf); // A mettre apres lecture de la conf $langs = new Translate('',$conf); // A mettre apres lecture de la conf
} }
/* /*
...@@ -107,9 +105,10 @@ if (! defined('NOREQUIREDB')) ...@@ -107,9 +105,10 @@ if (! defined('NOREQUIREDB'))
exit; exit;
} }
} }
// Now database connexion is known, so we can forget password // Now database connexion is known, so we can forget password
//$dolibarr_main_db_pass=''; // Comment this because this constant is used in a lot of pages //unset($dolibarr_main_db_pass); // We comment this because this constant is used in a lot of pages
$conf->db->pass=''; // This is to avoid password to be shown in memory/swap dump unset($conf->db->pass); // This is to avoid password to be shown in memory/swap dump
/* /*
* Creation objet $user * Creation objet $user
......
...@@ -119,8 +119,8 @@ llxFooterVierge(); ...@@ -119,8 +119,8 @@ llxFooterVierge();
/** /**
* Show header for card member * Show header for card member
* *
* @param string $title * @param string $title Title
* @param string $head * @param string $head More info into header
* @return void * @return void
*/ */
function llxHeaderVierge($title, $head = "") function llxHeaderVierge($title, $head = "")
......
...@@ -41,8 +41,8 @@ $langs->load("other"); ...@@ -41,8 +41,8 @@ $langs->load("other");
/** /**
* Show header for member list * Show header for member list
* *
* @param string $title * @param string $title Title
* @param string $head * @param string $head More info into header
* @return void * @return void
*/ */
function llxHeaderVierge($title, $head = "") function llxHeaderVierge($title, $head = "")
......
...@@ -218,25 +218,11 @@ if (GETPOST("action") == 'dopayment') ...@@ -218,25 +218,11 @@ if (GETPOST("action") == 'dopayment')
dol_syslog("email: $email", LOG_DEBUG); dol_syslog("email: $email", LOG_DEBUG);
dol_syslog("desc: $desc", LOG_DEBUG); dol_syslog("desc: $desc", LOG_DEBUG);
/*header("Content-type: text/html; charset=".$conf->file->character_set_client);
print '<html>'."\n";
print '<head>'."\n";
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=".$conf->file->character_set_client."\">\n";
print '</head>'."\n";
print '<body>'."\n";
print "\n";
*/
$_SESSION["Payment_Amount"]=$PAYPAL_API_PRICE; $_SESSION["Payment_Amount"]=$PAYPAL_API_PRICE;
// A redirect is added if API call successfull // A redirect is added if API call successfull
print_paypal_redirect($PAYPAL_API_PRICE,$PAYPAL_API_DEVISE,$PAYPAL_PAYMENT_TYPE,$PAYPAL_API_OK,$PAYPAL_API_KO, $FULLTAG); print_paypal_redirect($PAYPAL_API_PRICE,$PAYPAL_API_DEVISE,$PAYPAL_PAYMENT_TYPE,$PAYPAL_API_OK,$PAYPAL_API_KO, $FULLTAG);
/*print '</body></html>'."\n";
print "\n";
*/
exit; exit;
} }
} }
......
...@@ -193,7 +193,6 @@ function conf($dolibarr_main_document_root) ...@@ -193,7 +193,6 @@ function conf($dolibarr_main_document_root)
$conf->db->user = trim($dolibarr_main_db_user); $conf->db->user = trim($dolibarr_main_db_user);
$conf->db->pass = trim($dolibarr_main_db_pass); $conf->db->pass = trim($dolibarr_main_db_pass);
if (empty($conf->file->character_set_client)) $conf->file->character_set_client="UTF-8";
if (empty($conf->db->dolibarr_main_db_collation)) $conf->db->dolibarr_main_db_collation='latin1_swedish_ci'; if (empty($conf->db->dolibarr_main_db_collation)) $conf->db->dolibarr_main_db_collation='latin1_swedish_ci';
return 1; return 1;
...@@ -201,7 +200,12 @@ function conf($dolibarr_main_document_root) ...@@ -201,7 +200,12 @@ function conf($dolibarr_main_document_root)
/** /**
* \brief Show HTML header * Show HTML header
*
* @param string $soutitre Title
* @param string $next Next
* @param string $action Action
* @return void
*/ */
function pHeader($soutitre,$next,$action='none') function pHeader($soutitre,$next,$action='none')
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment