Qual: Some code cleaning

This commit is contained in:
Laurent Destailleur 2011-12-04 22:25:49 +01:00
parent 91a1c903a0
commit e6f3599847
10 changed files with 30 additions and 67 deletions

View File

@ -54,11 +54,7 @@ llxHeader();
$form = new Form($db);
// If lib forced
if (! empty($_GET["lib"])) $conf->global->MAIN_GRAPH_LIBRARY=$_GET["lib"];
$datetime = time();
$datetime = dol_now();
$year = dol_print_date($datetime, "%Y");
$month = dol_print_date($datetime, "%m");
$day = dol_print_date($datetime, "%d");

View File

@ -255,15 +255,15 @@ class Conf
$this->$module->dir_temp=$rootfordata."/".$module."/temp";
}
// For mycompany setup
// For mycompany storage
$this->mycompany->dir_output=$rootfordata."/mycompany";
$this->mycompany->dir_temp=$rootfordata."/mycompany/temp";
// For admin features
// For admin storage
$this->admin->dir_output=$rootfordata.'/admin';
$this->admin->dir_temp=$rootfordata.'/admin/temp';
// Module user
// For user storage
$this->user->dir_output=$rootforuser."/users";
$this->user->dir_temp=$rootforuser."/users/temp";
@ -309,10 +309,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)
{
$this->global->PRODUIT_USE_SEARCH_TO_SELECT=0;
}
if (! $this->use_javascript_ajax) $this->global->PRODUIT_USE_SEARCH_TO_SELECT=0;
// conf->currency
if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR';
@ -346,9 +343,6 @@ class Conf
$this->mailing->email_from=$this->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
// Format for date (used by default when not found or searched in lang)

View File

@ -66,15 +66,15 @@ class DolGraph
var $Legend=array();
var $LegendWidthMin=0;
var $graph; // Objet Graph (Artichow, Phplot...)
var $graph; // Objet Graph (Artichow, Phplot...)
var $error;
var $library=''; // Par defaut on utiliser PHPlot
var $library='artichow'; // Graphic library to use
var $bordercolor; // array(R,G,B)
var $bgcolor; // array(R,G,B)
var $bgcolorgrid; // array(R,G,B)
var $datacolor; // array(array(R,G,B),...)
var $bordercolor; // array(R,G,B)
var $bgcolor; // array(R,G,B)
var $bgcolorgrid; // array(R,G,B)
var $datacolor; // array(array(R,G,B),...)
/**
@ -85,7 +85,6 @@ class DolGraph
global $conf;
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
// Test si module GD present
$modules_list = get_loaded_extensions();
$isgdinstalled=0;
@ -99,15 +98,11 @@ class DolGraph
return -1;
}
// Defini proprietes de l'objet graphe
$this->library=$conf->global->MAIN_GRAPH_LIBRARY;
$this->bordercolor = array(235,235,224);
$this->datacolor = array(array(120,130,150), array(160,160,180), array(190,190,220));
$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))
{
include_once($color_file);

View File

@ -386,7 +386,6 @@ function build_rssfile($format,$title,$desc,$events_array,$outputfile,$filter=''
/**
* Encode for cal export
* string must be encoded in conf->file->character_set_client
*
* @param string $format vcal or ical
* @param string $string string to encode
@ -396,10 +395,8 @@ function format_cal($format,$string)
{
global $conf;
if ($conf->file->character_set_client == 'ISO-8859-1') $newstring=utf8_encode($string);
else $newstring=$string;
$newstring=$string;
// Now newstring is always UTF8 string
if ($format == 'vcal')
{
$newstring=quotedPrintEncode($newstring);

View File

@ -197,10 +197,6 @@ if ($action == "set")
//print "<tr><td>Creation de la table $name/td>";
$requestnb++;
if ($conf->file->character_set_client == "UTF-8")
{
$buffer=utf8_encode($buffer);
}
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);
$resql=$db->query($buffer,0,'dml');
@ -344,10 +340,6 @@ if ($action == "set")
//print "<tr><td>Creation des cles et index de la table $name: '$buffer'</td>";
$requestnb++;
if ($conf->file->character_set_client == "UTF-8")
{
$buffer=utf8_encode($buffer);
}
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);
$resql=$db->query($buffer,0,'dml');

View File

@ -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->file->main_limit_users = $dolibarr_main_limit_users;
$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
// Identifiant autres
// Identification mode
$conf->file->main_authentication = empty($dolibarr_main_authentication)?'':$dolibarr_main_authentication;
// 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
$conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey)?'':$dolibarr_main_cookie_cryptkey;
// Define array of document root directories
$conf->file->dol_document_root = array('main' => DOL_DOCUMENT_ROOT);
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;
}
}
// Force db type (for test purpose)
if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE');
// Multi-Company 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/
*/
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'))
exit;
}
}
// 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
$conf->db->pass=''; // This is to avoid password to be shown in memory/swap dump
//unset($dolibarr_main_db_pass); // We comment this because this constant is used in a lot of pages
unset($conf->db->pass); // This is to avoid password to be shown in memory/swap dump
/*
* Creation objet $user

View File

@ -119,8 +119,8 @@ llxFooterVierge();
/**
* Show header for card member
*
* @param string $title
* @param string $head
* @param string $title Title
* @param string $head More info into header
* @return void
*/
function llxHeaderVierge($title, $head = "")

View File

@ -41,8 +41,8 @@ $langs->load("other");
/**
* Show header for member list
*
* @param string $title
* @param string $head
* @param string $title Title
* @param string $head More info into header
* @return void
*/
function llxHeaderVierge($title, $head = "")

View File

@ -218,25 +218,11 @@ if (GETPOST("action") == 'dopayment')
dol_syslog("email: $email", 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;
// 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 '</body></html>'."\n";
print "\n";
*/
exit;
}
}

View File

@ -193,7 +193,6 @@ function conf($dolibarr_main_document_root)
$conf->db->user = trim($dolibarr_main_db_user);
$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';
return 1;
@ -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')
{