Qual: Removed useless calls

Doxygen
This commit is contained in:
Laurent Destailleur 2011-12-07 17:28:11 +01:00
parent 4cf3ad2f02
commit 53181aa0c1
6 changed files with 79 additions and 76 deletions

View File

@ -646,7 +646,7 @@ else
else else
{ {
print '<div class="error">'.$langs->trans("ServerNotAvailableOnIPOrPort",$server,$port); print '<div class="error">'.$langs->trans("ServerNotAvailableOnIPOrPort",$server,$port);
if ($mail->error) print ' - '.$langs->convToOutputCharset($mail->error,'ISO-8859-1'); if ($mail->error) print ' - '.$mail->error;
print '</div>'; print '</div>';
} }
print '<br>'; print '<br>';

View File

@ -306,7 +306,7 @@ else
else else
{ {
print '<div class="error">'.$langs->trans("ServerNotAvailableOnIPOrPort",$server,$port); print '<div class="error">'.$langs->trans("ServerNotAvailableOnIPOrPort",$server,$port);
if ($mail->error) print ' - '.$langs->convToOutputCharset($mail->error,'ISO-8859-1'); if ($mail->error) print ' - '.$mail->error;
print '</div>'; print '</div>';
} }
print '<br>'; print '<br>';

View File

@ -81,19 +81,19 @@ class CMailFile
/** /**
* CMailFile * CMailFile
* *
* @param subject Topic/Subject of mail * @param string $subject Topic/Subject of mail
* @param to Recipients emails (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]") * @param string $to Recipients emails (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
* @param from Sender email (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]") * @param string $from Sender email (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
* @param msg Message * @param string $msg Message
* @param filename_list List of files to attach (full path of filename on file system) * @param array $filename_list List of files to attach (full path of filename on file system)
* @param mimetype_list List of MIME type of attached files * @param array $mimetype_list List of MIME type of attached files
* @param mimefilename_list List of attached file name in message * @param array $mimefilename_list List of attached file name in message
* @param addr_cc Email cc * @param string $addr_cc Email cc
* @param addr_bcc Email bcc * @param string $addr_bcc Email bcc
* @param deliveryreceipt Ask a delivery receipt * @param int $deliveryreceipt Ask a delivery receipt
* @param msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
* @param errors_to Email errors * @param string $errors_to Email errors
* @param css Css option * @param string $css Css option
*/ */
function CMailFile($subject,$to,$from,$msg, function CMailFile($subject,$to,$from,$msg,
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(), $filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
@ -524,8 +524,8 @@ class CMailFile
/** /**
* Correct an uncomplete html string * Correct an uncomplete html string
* *
* @param $msg * @param string $msg String
* @return * @return string Completed string
*/ */
function checkIfHTML($msg) function checkIfHTML($msg)
{ {
@ -615,9 +615,9 @@ class CMailFile
/** /**
* Create header MIME (mode = 'mail') * Create header MIME (mode = 'mail')
* *
* @param filename_list * @param array $filename_list Array of filenames
* @param mimefilename_list * @param array $mimefilename_list Array of mime types
* @return mime headers * @return array mime headers
*/ */
function write_mimeheaders($filename_list, $mimefilename_list) function write_mimeheaders($filename_list, $mimefilename_list)
{ {
@ -644,7 +644,8 @@ class CMailFile
/** /**
* Return email content (mode = 'mail') * Return email content (mode = 'mail')
* *
* @param msgtext * @param string $msgtext Message string
* @return string String content
*/ */
function write_body($msgtext) function write_body($msgtext)
{ {
@ -675,7 +676,7 @@ class CMailFile
} }
// Make RFC821 Compliant, replace bare linefeeds // Make RFC821 Compliant, replace bare linefeeds
$strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $strContent ); $strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $strContent);
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems bugged //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems bugged
$strContent = rtrim(wordwrap($strContent)); $strContent = rtrim(wordwrap($strContent));
@ -708,10 +709,10 @@ class CMailFile
/** /**
* Attach file to email (mode = 'mail') * Attach file to email (mode = 'mail')
* *
* @param filename_list Tableau * @param array $filename_list Tableau
* @param mimetype_list Tableau * @param array $mimetype_list Tableau
* @param mimefilename_list Tableau * @param array $mimefilename_list Tableau
* @return out Chaine fichiers encodes * @return string Chaine fichiers encodes
*/ */
function write_files($filename_list,$mimetype_list,$mimefilename_list) function write_files($filename_list,$mimetype_list,$mimefilename_list)
{ {
@ -753,8 +754,8 @@ class CMailFile
/** /**
* Attach an image to email (mode = 'mail') * Attach an image to email (mode = 'mail')
* *
* @param images_list Tableau * @param array $images_list Tableau
* @return out Chaine images encodees * @return string Chaine images encodees
*/ */
function write_images($images_list) function write_images($images_list)
{ {
@ -784,9 +785,9 @@ class CMailFile
/** /**
* Try to create a socket connection * Try to create a socket connection
* *
* @param $host Add ssl:// for SSL/TLS. * @param string $host Add ssl:// for SSL/TLS.
* @param $port Example: 25, 465 * @param int $port Example: 25, 465
* @return Socket id if ok, 0 if KO * @return int Socket id if ok, 0 if KO
*/ */
function check_server_port($host,$port) function check_server_port($host,$port)
{ {
@ -797,11 +798,13 @@ class CMailFile
{ {
dol_syslog("Try socket connection to host=".$host." port=".$port); dol_syslog("Try socket connection to host=".$host." port=".$port);
//See if we can connect to the SMTP server //See if we can connect to the SMTP server
if ( $socket = @fsockopen($host, // Host to test, IP or domain. Add ssl:// for SSL/TLS. if ($socket = @fsockopen(
$port, // which Port number to use $host, // Host to test, IP or domain. Add ssl:// for SSL/TLS.
$errno, // actual system level error $port, // which Port number to use
$errstr, // and any text that goes with the error $errno, // actual system level error
$timeout) ) // timeout for reading/writing data over the socket $errstr, // and any text that goes with the error
$timeout
)) // timeout for reading/writing data over the socket
{ {
// Windows still does not have support for this timeout function // Windows still does not have support for this timeout function
if (function_exists('stream_set_timeout')) stream_set_timeout($socket, $timeout, 0); if (function_exists('stream_set_timeout')) stream_set_timeout($socket, $timeout, 0);
@ -813,7 +816,7 @@ class CMailFile
} }
else else
{ {
$this->error = 'Error '.$errno.' - '.$errstr; $this->error = utf8_check('Error '.$errno.' - '.$errstr)?'Error '.$errno.' - '.$errstr:utf8_encode('Error '.$errno.' - '.$errstr);
} }
} }
return $_retVal; return $_retVal;
@ -823,9 +826,9 @@ class CMailFile
* This function has been modified as provided by SirSir to allow multiline responses when * This function has been modified as provided by SirSir to allow multiline responses when
* using SMTP Extensions. * using SMTP Extensions.
* *
* @param socket * @param Socket $socket Socket
* @param response * @param string $response Response string
* @return boolean * @return boolean true if success
*/ */
function server_parse($socket, $response) function server_parse($socket, $response)
{ {
@ -853,8 +856,8 @@ class CMailFile
/** /**
* Seearch images into html message and init array this->images_encoded if found * Seearch images into html message and init array this->images_encoded if found
* *
* @param images_dir Location of physical images files * @param string $images_dir Location of physical images files
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function findHtmlImages($images_dir) function findHtmlImages($images_dir)
{ {
@ -943,11 +946,11 @@ class CMailFile
/** /**
* Return an address for SMTP protocol * Return an address for SMTP protocol
* *
* @param adresses Example: 'John Doe <john@doe.com>' or 'john@doe.com' * @param string $adresses Example: 'John Doe <john@doe.com>' or 'john@doe.com'
* @param format 0=Auto, 1=emails with <>, 2=emails without <> * @param int $format 0=Auto, 1=emails with <>, 2=emails without <>
* @param encode 1=Encode name to RFC2822 * @param int $encode 1=Encode name to RFC2822
* @return string If format 1: '<john@doe.com>' or 'John Doe <john@doe.com>' * @return string If format 1: '<john@doe.com>' or 'John Doe <john@doe.com>'
* If format 2: 'john@doe.com' * If format 2: 'john@doe.com'
*/ */
function getValidAddress($adresses,$format,$encode='') function getValidAddress($adresses,$format,$encode='')
{ {

View File

@ -49,8 +49,8 @@ class Translate {
/** /**
* Constructor * Constructor
* *
* @param dir Force directory that contains /langs subdirectory (value is sometine '..' like into install/* pages or support/* pages). * @param string $dir Force directory that contains /langs subdirectory (value is sometine '..' like into install/* pages or support/* pages).
* @param conf Object with Dolibarr configuration * @param Conf $conf Object with Dolibarr configuration
*/ */
function Translate($dir = "",$conf) function Translate($dir = "",$conf)
{ {
@ -63,7 +63,7 @@ class Translate {
/** /**
* Set accessor for this->defaultlang * Set accessor for this->defaultlang
* *
* @param srclang Language to use * @param string $srclang Language to use
*/ */
function setDefaultLang($srclang='fr_FR') function setDefaultLang($srclang='fr_FR')
{ {
@ -129,8 +129,8 @@ class Translate {
* Return active language code for current user * Return active language code for current user
* It's an accessor for this->defaultlang * It's an accessor for this->defaultlang
* *
* @param mode 0=Long language code, 1=Short language code * @param int $mode 0=Long language code, 1=Short language code
* @return string Language code used (en_US, en_AU, fr_FR, ...) * @return string Language code used (en_US, en_AU, fr_FR, ...)
*/ */
function getDefaultLang($mode=0) function getDefaultLang($mode=0)
{ {
@ -337,8 +337,8 @@ class Translate {
* WARNING: To avoid infinite loop (getLabelFromKey->transnoentities->getTradFromKey), getLabelFromKey must * WARNING: To avoid infinite loop (getLabelFromKey->transnoentities->getTradFromKey), getLabelFromKey must
* not be called with same value than input. * not be called with same value than input.
* *
* @param key * @param string $key Key to translate
* @return string * @return string Translated string
*/ */
function getTradFromKey($key) function getTradFromKey($key)
{ {
@ -379,13 +379,13 @@ class Translate {
* et si toujours pas trouve, il est retourne tel quel * et si toujours pas trouve, il est retourne tel quel
* Les parametres de cette methode peuvent contenir de balises HTML. * Les parametres de cette methode peuvent contenir de balises HTML.
* *
* @param key cle de chaine a traduire * @param string $key Key to translate
* @param param1 chaine de param1 * @param string $param1 chaine de param1
* @param param2 chaine de param2 * @param string $param2 chaine de param2
* @param param3 chaine de param3 * @param string $param3 chaine de param3
* @param param4 chaine de param4 * @param string $param4 chaine de param4
* @param maxsize taille max * @param int $maxsize taille max
* @return string Chaine traduite et code en HTML * @return string Translated string (encoded into HTML entities and UTF8)
*/ */
function trans($key, $param1='', $param2='', $param3='', $param4='', $maxsize=0) function trans($key, $param1='', $param2='', $param3='', $param4='', $maxsize=0)
{ {
@ -400,7 +400,7 @@ class Translate {
// We replace some HTML tags by __xx__ to avoid having them encoded by htmlentities // We replace some HTML tags by __xx__ to avoid having them encoded by htmlentities
$str=str_replace(array('<','>','"',),array('__lt__','__gt__','__quot__'),$str); $str=str_replace(array('<','>','"',),array('__lt__','__gt__','__quot__'),$str);
$str=$this->convToOutputCharset($str); // Convert string to $this->charset_output //$str=$this->convToOutputCharset($str); // Convert string to $this->charset_output
// Crypt string into HTML // Crypt string into HTML
// $str est une chaine stockee en memoire au format $this->charset_output // $str est une chaine stockee en memoire au format $this->charset_output
@ -413,7 +413,7 @@ class Translate {
else // Translation is not available else // Translation is not available
{ {
$str=$this->getTradFromKey($key); $str=$this->getTradFromKey($key);
return $this->convToOutputCharset($str); //return $this->convToOutputCharset($str);
} }
} }

View File

@ -258,7 +258,7 @@ function html_print_paybox_footer($fromcompany,$langs)
$line1=""; $line1="";
if ($fromcompany->forme_juridique_code) if ($fromcompany->forme_juridique_code)
{ {
$line1.=($line1?" - ":"").$langs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); $line1.=($line1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
} }
// Capital // Capital
if ($fromcompany->capital) if ($fromcompany->capital)
@ -270,14 +270,14 @@ function html_print_paybox_footer($fromcompany,$langs)
{ {
$field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof1); $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1;
} }
// Prof Id 2 // Prof Id 2
if ($fromcompany->idprof2) if ($fromcompany->idprof2)
{ {
$field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof2); $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2;
} }
// Second line of company infos // Second line of company infos
@ -287,19 +287,19 @@ function html_print_paybox_footer($fromcompany,$langs)
{ {
$field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof3); $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3;
} }
// Prof Id 4 // Prof Id 4
if ($fromcompany->idprof4) if ($fromcompany->idprof4)
{ {
$field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof4); $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4;
} }
// IntraCommunautary VAT // IntraCommunautary VAT
if ($fromcompany->tva_intra != '') if ($fromcompany->tva_intra != '')
{ {
$line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$langs->convToOutputCharset($fromcompany->tva_intra); $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
} }
print '<br><br><hr>'."\n"; print '<br><br><hr>'."\n";

View File

@ -86,7 +86,7 @@ function html_print_paypal_footer($fromcompany,$langs)
$line1=""; $line1="";
if ($fromcompany->forme_juridique_code) if ($fromcompany->forme_juridique_code)
{ {
$line1.=($line1?" - ":"").$langs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); $line1.=($line1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
} }
// Capital // Capital
if ($fromcompany->capital) if ($fromcompany->capital)
@ -98,14 +98,14 @@ function html_print_paypal_footer($fromcompany,$langs)
{ {
$field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof1); $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof1;
} }
// Prof Id 2 // Prof Id 2
if ($fromcompany->idprof2) if ($fromcompany->idprof2)
{ {
$field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof2); $line1.=($line1?" - ":"").$field.": ".$fromcompany->idprof2;
} }
// Second line of company infos // Second line of company infos
@ -115,19 +115,19 @@ function html_print_paypal_footer($fromcompany,$langs)
{ {
$field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof3); $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof3;
} }
// Prof Id 4 // Prof Id 4
if ($fromcompany->idprof4) if ($fromcompany->idprof4)
{ {
$field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code); $field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1];
$line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof4); $line2.=($line2?" - ":"").$field.": ".$fromcompany->idprof4;
} }
// IntraCommunautary VAT // IntraCommunautary VAT
if ($fromcompany->tva_intra != '') if ($fromcompany->tva_intra != '')
{ {
$line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$langs->convToOutputCharset($fromcompany->tva_intra); $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
} }
print '<br><br><hr>'."\n"; print '<br><br><hr>'."\n";