@@ -17,10 +17,10 @@ |
||
17 | 17 | */ |
18 | 18 | |
19 | 19 | /** |
20 | - * \file htdocs/webportal/class/controller.class.php |
|
21 | - * \ingroup webportal |
|
22 | - * \brief File of controller class for WebPortal |
|
23 | - */ |
|
20 | + * \file htdocs/webportal/class/controller.class.php |
|
21 | + * \ingroup webportal |
|
22 | + * \brief File of controller class for WebPortal |
|
23 | + */ |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Class to manage pages |
@@ -17,10 +17,10 @@ |
||
17 | 17 | */ |
18 | 18 | |
19 | 19 | /** |
20 | - * \file htdocs/webportal/class/context.class.php |
|
21 | - * \ingroup webportal |
|
22 | - * \brief File of context class for WebPortal |
|
23 | - */ |
|
20 | + * \file htdocs/webportal/class/context.class.php |
|
21 | + * \ingroup webportal |
|
22 | + * \brief File of context class for WebPortal |
|
23 | + */ |
|
24 | 24 | |
25 | 25 | require_once __DIR__ . '/controller.class.php'; |
26 | 26 | require_once __DIR__ . '/webPortalTheme.class.php'; |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * \brief File of context class for WebPortal |
23 | 23 | */ |
24 | 24 | |
25 | -require_once __DIR__ . '/controller.class.php'; |
|
26 | -require_once __DIR__ . '/webPortalTheme.class.php'; |
|
25 | +require_once __DIR__.'/controller.class.php'; |
|
26 | +require_once __DIR__.'/webPortalTheme.class.php'; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Class Context |
@@ -160,16 +160,16 @@ discard block |
||
160 | 160 | |
161 | 161 | $this->db = $db; |
162 | 162 | |
163 | - $this->tplDir = __DIR__ . '/../'; |
|
163 | + $this->tplDir = __DIR__.'/../'; |
|
164 | 164 | |
165 | 165 | $this->getControllerUrl(); |
166 | 166 | |
167 | 167 | $this->topMenu = new stdClass(); |
168 | 168 | |
169 | - $this->tplPath = realpath(__DIR__ . '/../../public/webportal/tpl'); |
|
169 | + $this->tplPath = realpath(__DIR__.'/../../public/webportal/tpl'); |
|
170 | 170 | |
171 | 171 | $this->controller = GETPOST('controller', 'aZ09'); // for security, limited to 'aZ09' |
172 | - $this->action = GETPOST('action', 'aZ09');// for security, limited to 'aZ09' |
|
172 | + $this->action = GETPOST('action', 'aZ09'); // for security, limited to 'aZ09' |
|
173 | 173 | |
174 | 174 | if (empty($this->controller)) { |
175 | 175 | $this->controller = 'default'; |
@@ -211,17 +211,17 @@ discard block |
||
211 | 211 | { |
212 | 212 | global $db, $conf, $langs; |
213 | 213 | |
214 | - $defaultControllersPath = __DIR__ . '/../controllers/'; |
|
214 | + $defaultControllersPath = __DIR__.'/../controllers/'; |
|
215 | 215 | |
216 | 216 | // define controllers definition |
217 | - $this->addControllerDefinition('login', $defaultControllersPath . 'login.controller.class.php', 'LoginController'); |
|
218 | - $this->addControllerDefinition('default', $defaultControllersPath . 'default.controller.class.php', 'DefaultController'); |
|
219 | - $this->addControllerDefinition('document', $defaultControllersPath . 'document.controller.class.php', 'DocumentController'); |
|
220 | - $this->addControllerDefinition('propallist', $defaultControllersPath . 'propallist.controller.class.php', 'PropalListController'); |
|
221 | - $this->addControllerDefinition('orderlist', $defaultControllersPath . 'orderlist.controller.class.php', 'OrderListController'); |
|
222 | - $this->addControllerDefinition('invoicelist', $defaultControllersPath . 'invoicelist.controller.class.php', 'InvoiceListController'); |
|
223 | - $this->addControllerDefinition('membercard', $defaultControllersPath . 'membercard.controller.class.php', 'MemberCardController'); |
|
224 | - $this->addControllerDefinition('partnershipcard', $defaultControllersPath . 'partnershipcard.controller.class.php', 'PartnershipCardController'); |
|
217 | + $this->addControllerDefinition('login', $defaultControllersPath.'login.controller.class.php', 'LoginController'); |
|
218 | + $this->addControllerDefinition('default', $defaultControllersPath.'default.controller.class.php', 'DefaultController'); |
|
219 | + $this->addControllerDefinition('document', $defaultControllersPath.'document.controller.class.php', 'DocumentController'); |
|
220 | + $this->addControllerDefinition('propallist', $defaultControllersPath.'propallist.controller.class.php', 'PropalListController'); |
|
221 | + $this->addControllerDefinition('orderlist', $defaultControllersPath.'orderlist.controller.class.php', 'OrderListController'); |
|
222 | + $this->addControllerDefinition('invoicelist', $defaultControllersPath.'invoicelist.controller.class.php', 'InvoiceListController'); |
|
223 | + $this->addControllerDefinition('membercard', $defaultControllersPath.'membercard.controller.class.php', 'MemberCardController'); |
|
224 | + $this->addControllerDefinition('partnershipcard', $defaultControllersPath.'partnershipcard.controller.class.php', 'PartnershipCardController'); |
|
225 | 225 | |
226 | 226 | // call triggers |
227 | 227 | //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $length = strlen($needle); |
256 | 256 | $isControllerFile = $length > 0 ? substr($fileName, -$length) === $needle : true; |
257 | 257 | if (!$isControllerFile) { |
258 | - $this->setError('Error: controller definition ' . $fileName); |
|
258 | + $this->setError('Error: controller definition '.$fileName); |
|
259 | 259 | return false; |
260 | 260 | } |
261 | 261 | |
@@ -375,9 +375,9 @@ discard block |
||
375 | 375 | if (!empty($Tparams)) { |
376 | 376 | $TCompiledAttr = array(); |
377 | 377 | foreach ($Tparams as $key => $value) { |
378 | - $TCompiledAttr[] = $key . '=' . $value; |
|
378 | + $TCompiledAttr[] = $key.'='.$value; |
|
379 | 379 | } |
380 | - $url .= '?' . implode("&", $TCompiledAttr); |
|
380 | + $url .= '?'.implode("&", $TCompiledAttr); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | // if $moreParams is a string |
@@ -405,13 +405,13 @@ discard block |
||
405 | 405 | |
406 | 406 | $ssl = (!empty($s['HTTPS']) && $s['HTTPS'] == 'on'); |
407 | 407 | $sp = strtolower($s['SERVER_PROTOCOL']); |
408 | - $protocol = substr($sp, 0, strpos($sp, '/')) . (($ssl) ? 's' : ''); |
|
408 | + $protocol = substr($sp, 0, strpos($sp, '/')).(($ssl) ? 's' : ''); |
|
409 | 409 | $port = $s['SERVER_PORT']; |
410 | - $port = ((!$ssl && $port == '80') || ($ssl && $port == '443')) ? '' : ':' . $port; |
|
410 | + $port = ((!$ssl && $port == '80') || ($ssl && $port == '443')) ? '' : ':'.$port; |
|
411 | 411 | $host = ($use_forwarded_host && isset($s['HTTP_X_FORWARDED_HOST'])) ? $s['HTTP_X_FORWARDED_HOST'] : (isset($s['HTTP_HOST']) ? $s['HTTP_HOST'] : null); |
412 | - $host = isset($host) ? $host : $s['SERVER_NAME'] . $port; |
|
412 | + $host = isset($host) ? $host : $s['SERVER_NAME'].$port; |
|
413 | 413 | |
414 | - $url = $protocol . '://' . $host; |
|
414 | + $url = $protocol.'://'.$host; |
|
415 | 415 | |
416 | 416 | if ($withRequestUri) { |
417 | 417 | $url .= $s['REQUEST_URI']; |
@@ -530,10 +530,10 @@ discard block |
||
530 | 530 | public function setEventMessages($mesg, $mesgs, $style = 'mesgs') |
531 | 531 | { |
532 | 532 | if (empty($mesg) && empty($mesgs)) { |
533 | - dol_syslog(__METHOD__ . ' Try to add a message in stack, but value to add is empty message', LOG_WARNING); |
|
533 | + dol_syslog(__METHOD__.' Try to add a message in stack, but value to add is empty message', LOG_WARNING); |
|
534 | 534 | } else { |
535 | 535 | if (!in_array((string) $style, array('mesgs', 'warnings', 'errors'))) { |
536 | - dol_print_error('', 'Bad parameter style=' . $style . ' for setEventMessages'); |
|
536 | + dol_print_error('', 'Bad parameter style='.$style.' for setEventMessages'); |
|
537 | 537 | } |
538 | 538 | if (empty($mesgs)) { |
539 | 539 | $this->setEventMessage($mesg, $style); |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | { |
594 | 594 | $currentToken = $this->newToken(); |
595 | 595 | // Creation of a token against CSRF vulnerabilities |
596 | - if (!defined('NOTOKENRENEWAL') || empty($currentToken) ) { |
|
596 | + if (!defined('NOTOKENRENEWAL') || empty($currentToken)) { |
|
597 | 597 | // Rolling token at each call ($_SESSION['token'] contains token of previous page) |
598 | 598 | if (isset($_SESSION['newtoken'])) { |
599 | 599 | $_SESSION['token'] = $_SESSION['newtoken']; |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | { |
619 | 619 | $token = $this->newToken(); |
620 | 620 | if ($token) { |
621 | - return '&' . $this->tokenKey . '=' . $this->newToken(); |
|
621 | + return '&'.$this->tokenKey.'='.$this->newToken(); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | return null; |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | { |
634 | 634 | $token = $this->newToken(); |
635 | 635 | if ($token) { |
636 | - return '<input type="hidden" name="' . $this->tokenKey . '" value="' . $this->newToken() . '" />'; |
|
636 | + return '<input type="hidden" name="'.$this->tokenKey.'" value="'.$this->newToken().'" />'; |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | return null; |
@@ -651,14 +651,14 @@ discard block |
||
651 | 651 | $id = 0; |
652 | 652 | |
653 | 653 | $sql = "SELECT sa.rowid as id, sa.pass_crypted"; |
654 | - $sql .= " FROM " . $this->db->prefix() . "societe_account as sa"; |
|
655 | - $sql .= " WHERE BINARY sa.login = '" . $this->db->escape($login) . "'"; // case sensitive |
|
654 | + $sql .= " FROM ".$this->db->prefix()."societe_account as sa"; |
|
655 | + $sql .= " WHERE BINARY sa.login = '".$this->db->escape($login)."'"; // case sensitive |
|
656 | 656 | //$sql .= " AND BINARY sa.pass_crypted = '" . $this->db->escape($pass) . "'"; // case sensitive |
657 | 657 | $sql .= " AND sa.site = 'dolibarr_portal'"; |
658 | 658 | $sql .= " AND sa.status = 1"; |
659 | - $sql .= " AND sa.entity IN (" . getEntity('societe') . ")"; |
|
659 | + $sql .= " AND sa.entity IN (".getEntity('societe').")"; |
|
660 | 660 | |
661 | - dol_syslog(__METHOD__ . ' Try to find the third-party account id for login"' . $login . '" and site="dolibarr_portal"', LOG_DEBUG); |
|
661 | + dol_syslog(__METHOD__.' Try to find the third-party account id for login"'.$login.'" and site="dolibarr_portal"', LOG_DEBUG); |
|
662 | 662 | $result = $this->db->query($sql); |
663 | 663 | if ($result) { |
664 | 664 | if ($this->db->num_rows($result) == 1) { |
@@ -689,13 +689,13 @@ discard block |
||
689 | 689 | if ($passok) { |
690 | 690 | $id = $obj->id; |
691 | 691 | } else { |
692 | - dol_syslog(__METHOD__ .' Authentication KO bad password for ' . $login . ', cryptType=' . $cryptType, LOG_NOTICE); |
|
692 | + dol_syslog(__METHOD__.' Authentication KO bad password for '.$login.', cryptType='.$cryptType, LOG_NOTICE); |
|
693 | 693 | sleep(1); // Brut force protection. Must be same delay when login is not valid |
694 | 694 | return -3; |
695 | 695 | } |
696 | 696 | } |
697 | 697 | } else { |
698 | - dol_syslog(__METHOD__ . ' Many third-party account found for login"' . $login . '" and site="dolibarr_portal"', LOG_ERR); |
|
698 | + dol_syslog(__METHOD__.' Many third-party account found for login"'.$login.'" and site="dolibarr_portal"', LOG_ERR); |
|
699 | 699 | return -2; |
700 | 700 | } |
701 | 701 | } else { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * \remarks To run this script as CLI: phpunit filename.php |
25 | 25 | */ |
26 | 26 | |
27 | -global $conf,$user,$langs,$db; |
|
27 | +global $conf, $user, $langs, $db; |
|
28 | 28 | //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver |
29 | 29 | //require_once 'PHPUnit/Autoload.php'; |
30 | 30 | require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
63 | - global $conf,$user,$langs,$db; |
|
63 | + global $conf, $user, $langs, $db; |
|
64 | 64 | $conf = $this->savconf; |
65 | 65 | $user = $this->savuser; |
66 | 66 | $langs = $this->savlangs; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \remarks To run this script as CLI: phpunit filename.php |
26 | 26 | */ |
27 | 27 | |
28 | -global $conf,$user,$langs,$db; |
|
28 | +global $conf, $user, $langs, $db; |
|
29 | 29 | //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver |
30 | 30 | //require_once 'PHPUnit/Autoload.php'; |
31 | 31 | require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function testFactureCreate() |
71 | 71 | { |
72 | - global $conf,$user,$langs,$db; |
|
72 | + global $conf, $user, $langs, $db; |
|
73 | 73 | $conf = $this->savconf; |
74 | 74 | $user = $this->savuser; |
75 | 75 | $langs = $this->savlangs; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function testFactureFetch($id) |
96 | 96 | { |
97 | - global $conf,$user,$langs,$db; |
|
97 | + global $conf, $user, $langs, $db; |
|
98 | 98 | $conf = $this->savconf; |
99 | 99 | $user = $this->savuser; |
100 | 100 | $langs = $this->savlangs; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function testFactureUpdate($localobject) |
121 | 121 | { |
122 | - global $conf,$user,$langs,$db; |
|
122 | + global $conf, $user, $langs, $db; |
|
123 | 123 | $conf = $this->savconf; |
124 | 124 | $user = $this->savuser; |
125 | 125 | $langs = $this->savlangs; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function testFactureValid($localobject) |
146 | 146 | { |
147 | - global $conf,$user,$langs,$db; |
|
147 | + global $conf, $user, $langs, $db; |
|
148 | 148 | $conf = $this->savconf; |
149 | 149 | $user = $this->savuser; |
150 | 150 | $langs = $this->savlangs; |
@@ -169,15 +169,15 @@ discard block |
||
169 | 169 | $newlocalobject, |
170 | 170 | true, |
171 | 171 | array( |
172 | - 'newref','oldref','id','lines','client','thirdparty','brouillon','user_creation_id','date_creation','date_validation','datem','date_modification', |
|
173 | - 'ref','statut','status','paye','specimen','ref','actiontypecode','actionmsg2','actionmsg','mode_reglement','cond_reglement', |
|
172 | + 'newref', 'oldref', 'id', 'lines', 'client', 'thirdparty', 'brouillon', 'user_creation_id', 'date_creation', 'date_validation', 'datem', 'date_modification', |
|
173 | + 'ref', 'statut', 'status', 'paye', 'specimen', 'ref', 'actiontypecode', 'actionmsg2', 'actionmsg', 'mode_reglement', 'cond_reglement', |
|
174 | 174 | 'cond_reglement_doc', 'modelpdf', |
175 | - 'multicurrency_total_ht','multicurrency_total_tva', 'multicurrency_total_ttc','fk_multicurrency','multicurrency_code','multicurrency_tx', |
|
176 | - 'retained_warranty' ,'retained_warranty_date_limit', 'retained_warranty_fk_cond_reglement', 'specimen', 'situation_cycle_ref', 'situation_counter', 'situation_final', |
|
177 | - 'trackid','user_creat','user_valid' |
|
175 | + 'multicurrency_total_ht', 'multicurrency_total_tva', 'multicurrency_total_ttc', 'fk_multicurrency', 'multicurrency_code', 'multicurrency_tx', |
|
176 | + 'retained_warranty', 'retained_warranty_date_limit', 'retained_warranty_fk_cond_reglement', 'specimen', 'situation_cycle_ref', 'situation_counter', 'situation_final', |
|
177 | + 'trackid', 'user_creat', 'user_valid' |
|
178 | 178 | ) |
179 | 179 | ); |
180 | - $this->assertEquals($arraywithdiff, array()); // Actual, Expected |
|
180 | + $this->assertEquals($arraywithdiff, array()); // Actual, Expected |
|
181 | 181 | |
182 | 182 | return $localobject; |
183 | 183 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function testFactureOther($localobject) |
195 | 195 | { |
196 | - global $conf,$user,$langs,$db; |
|
196 | + global $conf, $user, $langs, $db; |
|
197 | 197 | $conf = $this->savconf; |
198 | 198 | $user = $this->savuser; |
199 | 199 | $langs = $this->savlangs; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public function testFactureDelete($id) |
228 | 228 | { |
229 | - global $conf,$user,$langs,$db; |
|
229 | + global $conf, $user, $langs, $db; |
|
230 | 230 | $conf = $this->savconf; |
231 | 231 | $user = $this->savuser; |
232 | 232 | $langs = $this->savlangs; |
@@ -249,21 +249,21 @@ discard block |
||
249 | 249 | |
250 | 250 | $conf->global->INVOICE_CAN_NEVER_BE_REMOVED = 1; |
251 | 251 | |
252 | - $result = $localobject2->delete($user); // Deletion is KO, option INVOICE_CAN_NEVER_BE_REMOVED is on |
|
252 | + $result = $localobject2->delete($user); // Deletion is KO, option INVOICE_CAN_NEVER_BE_REMOVED is on |
|
253 | 253 | print __METHOD__." id=".$localobject2->id." ref=".$localobject2->ref." result=".$result."\n"; |
254 | 254 | $this->assertEquals(0, $result, 'Deletion should fail, option INVOICE_CAN_NEVER_BE_REMOVED is on'); |
255 | 255 | |
256 | 256 | unset($conf->global->INVOICE_CAN_NEVER_BE_REMOVED); |
257 | 257 | |
258 | - $result = $localobject->delete($user); // Deletion is KO, it is not last invoice |
|
258 | + $result = $localobject->delete($user); // Deletion is KO, it is not last invoice |
|
259 | 259 | print __METHOD__." id=".$localobject->id." ref=".$localobject->ref." result=".$result."\n"; |
260 | 260 | $this->assertEquals(0, $result, 'Deletion should fail, it is not last invoice'); |
261 | 261 | |
262 | - $result = $localobject2->delete($user); // Deletion is OK, it is last invoice |
|
262 | + $result = $localobject2->delete($user); // Deletion is OK, it is last invoice |
|
263 | 263 | print __METHOD__." id=".$localobject2->id." ref=".$localobject2->ref." result=".$result."\n"; |
264 | 264 | $this->assertGreaterThan(0, $result, 'Deletion should work, it is last invoice'); |
265 | 265 | |
266 | - $result = $localobject->delete($user); // Deletion is KO, it is not last invoice |
|
266 | + $result = $localobject->delete($user); // Deletion is KO, it is not last invoice |
|
267 | 267 | print __METHOD__." id=".$localobject->id." ref=".$localobject->ref." result=".$result."\n"; |
268 | 268 | $this->assertGreaterThan(0, $result, 'Deletion should work, it is again last invoice'); |
269 | 269 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | if (in_array($sKey, $fieldstoignorearray)) { |
306 | 306 | continue; |
307 | 307 | } |
308 | - if (! $ignoretype && ($oVarsA[$sKey] !== $oVarsB[$sKey])) { |
|
308 | + if (!$ignoretype && ($oVarsA[$sKey] !== $oVarsB[$sKey])) { |
|
309 | 309 | $retAr[] = $sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]); |
310 | 310 | } |
311 | 311 | if ($ignoretype && ($oVarsA[$sKey] != $oVarsB[$sKey])) { |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | global $conf, $user, $langs, $db; |
28 | 28 | //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver |
29 | 29 | //require_once 'PHPUnit/Autoload.php'; |
30 | -require_once dirname(__FILE__) . '/../../htdocs/master.inc.php'; |
|
31 | -require_once dirname(__FILE__) . '/../../htdocs/core/class/CMailFile.class.php'; |
|
32 | -require_once dirname(__FILE__) . '/../../htdocs/core/lib/files.lib.php'; |
|
30 | +require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; |
|
31 | +require_once dirname(__FILE__).'/../../htdocs/core/class/CMailFile.class.php'; |
|
32 | +require_once dirname(__FILE__).'/../../htdocs/core/lib/files.lib.php'; |
|
33 | 33 | require_once dirname(__FILE__).'/CommonClassTest.class.php'; |
34 | 34 | |
35 | 35 | if (empty($user->id)) { |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | $localobject = new CMailFile('Test', '[email protected]', '[email protected]', 'Message txt', array(), array(), array(), '', '', 1, 0); |
66 | 66 | |
67 | 67 | $result = $localobject->sendfile(); |
68 | - print __METHOD__ . " result=" . $result . "\n"; |
|
69 | - $this->assertFalse($result); // False because mail send disabled |
|
68 | + print __METHOD__." result=".$result."\n"; |
|
69 | + $this->assertFalse($result); // False because mail send disabled |
|
70 | 70 | |
71 | 71 | return $result; |
72 | 72 | } |
@@ -88,42 +88,42 @@ discard block |
||
88 | 88 | |
89 | 89 | $src = 'John Doe <[email protected]>'; |
90 | 90 | $result = $localobject->getValidAddress($src, 0); |
91 | - print __METHOD__ . " result=" . $result . "\n"; |
|
91 | + print __METHOD__." result=".$result."\n"; |
|
92 | 92 | $this->assertEquals($result, 'John Doe <[email protected]>'); |
93 | 93 | |
94 | 94 | $src = 'John Doe <[email protected]>'; |
95 | 95 | $result = $localobject->getValidAddress($src, 1); |
96 | - print __METHOD__ . " result=" . $result . "\n"; |
|
96 | + print __METHOD__." result=".$result."\n"; |
|
97 | 97 | $this->assertEquals($result, '<[email protected]>'); |
98 | 98 | |
99 | 99 | $src = 'John Doe <[email protected]>'; |
100 | 100 | $result = $localobject->getValidAddress($src, 2); |
101 | - print __METHOD__ . " result=" . $result . "\n"; |
|
101 | + print __METHOD__." result=".$result."\n"; |
|
102 | 102 | $this->assertEquals($result, '[email protected]'); |
103 | 103 | |
104 | 104 | $src = 'John Doe <[email protected]>'; |
105 | 105 | $result = $localobject->getValidAddress($src, 3, 0); |
106 | - print __METHOD__ . " result=" . $result . "\n"; |
|
106 | + print __METHOD__." result=".$result."\n"; |
|
107 | 107 | $this->assertEquals($result, '"John Doe" <[email protected]>'); |
108 | 108 | |
109 | 109 | $src = 'John Doe <[email protected]>'; |
110 | 110 | $result = $localobject->getValidAddress($src, 3, 1); |
111 | - print __METHOD__ . " result=" . $result . "\n"; |
|
111 | + print __METHOD__." result=".$result."\n"; |
|
112 | 112 | $this->assertEquals($result, '"=?UTF-8?B?Sm9obiBEb2U=?=" <[email protected]>'); |
113 | 113 | |
114 | 114 | $src = 'John Doe <[email protected]>'; |
115 | 115 | $result = $localobject->getValidAddress($src, 4); |
116 | - print __METHOD__ . " result=" . $result . "\n"; |
|
116 | + print __METHOD__." result=".$result."\n"; |
|
117 | 117 | $this->assertEquals($result, 'John Doe'); |
118 | 118 | |
119 | 119 | $src = 'John Doe <[email protected]>, John Doe2 <[email protected]>, John Doe3 <[email protected]>'; |
120 | 120 | $result = $localobject->getValidAddress($src, 4); |
121 | - print __METHOD__ . " result=" . $result . "\n"; |
|
121 | + print __METHOD__." result=".$result."\n"; |
|
122 | 122 | $this->assertEquals($result, 'John Doe,John Doe2,John Doe3'); |
123 | 123 | |
124 | 124 | $src = 'John Doe <[email protected]>, John Doe2 <[email protected]>, John Doe3 <[email protected]>'; |
125 | 125 | $result = $localobject->getValidAddress($src, 4, 0, 2); |
126 | - print __METHOD__ . " result=" . $result . "\n"; |
|
126 | + print __METHOD__." result=".$result."\n"; |
|
127 | 127 | $this->assertEquals($result, 'John Doe,John Doe2...'); |
128 | 128 | |
129 | 129 | return $result; |
@@ -146,44 +146,44 @@ discard block |
||
146 | 146 | $conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS = 1; |
147 | 147 | $conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_DATA = 1; |
148 | 148 | |
149 | - dol_delete_dir_recursive(DOL_DATA_ROOT . '/medias/image'); |
|
150 | - dol_mkdir(DOL_DATA_ROOT . '/medias/image'); |
|
151 | - dol_copy(dirname(__FILE__) . '/img250x20.png', DOL_DATA_ROOT . '/medias/image/img250x20.png'); |
|
149 | + dol_delete_dir_recursive(DOL_DATA_ROOT.'/medias/image'); |
|
150 | + dol_mkdir(DOL_DATA_ROOT.'/medias/image'); |
|
151 | + dol_copy(dirname(__FILE__).'/img250x20.png', DOL_DATA_ROOT.'/medias/image/img250x20.png'); |
|
152 | 152 | |
153 | 153 | $msg = '<html><body>'; |
154 | 154 | $msg .= '<img alt="" src="/viewimage.php?modulepart=medias&entity=1&file=image/img250x20.png" style="height:39px; width:150px" />'; |
155 | 155 | $msg .= ' <p>From wikipedia</p> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />'; |
156 | 156 | $msg .= '</body></html>'; |
157 | 157 | |
158 | - $tmp_dir = $conf->admin->dir_temp.'/'.__FUNCTION__.getmypid().'_tmp'; |
|
158 | + $tmp_dir = $conf->admin->dir_temp.'/'.__FUNCTION__.getmypid().'_tmp'; |
|
159 | 159 | $localobject = new CMailFile('Test', '[email protected]', '[email protected]', $msg, array(), array(), array(), '', '', 0, -1, '', '', '', '', 'standard', '', $tmp_dir); |
160 | 160 | |
161 | 161 | $result = count($localobject->html_images); |
162 | - print __METHOD__ . " result count image detected in the mail=" . $result . "\n"; |
|
162 | + print __METHOD__." result count image detected in the mail=".$result."\n"; |
|
163 | 163 | $this->assertEquals($result, 2); |
164 | 164 | |
165 | 165 | |
166 | 166 | foreach ($localobject->html_images as $i => $val) { |
167 | 167 | if ($localobject->html_images[$i]) { |
168 | 168 | if (preg_match('/img250x20\.png/i', $localobject->html_images[$i]['fullpath'])) { |
169 | - print __METHOD__ . " content type must be image png =" . $localobject->html_images[$i]['content_type'] . "\n"; |
|
169 | + print __METHOD__." content type must be image png =".$localobject->html_images[$i]['content_type']."\n"; |
|
170 | 170 | $this->assertEquals($localobject->html_images[$i]['content_type'], 'image/png'); |
171 | 171 | |
172 | - print __METHOD__ . " type must be cidfromurl =" . $localobject->html_images[$i]['type'] . "\n"; |
|
172 | + print __METHOD__." type must be cidfromurl =".$localobject->html_images[$i]['type']."\n"; |
|
173 | 173 | $this->assertEquals($localobject->html_images[$i]['type'], 'cidfromurl'); |
174 | 174 | |
175 | 175 | $fileSize = 9744; |
176 | - print __METHOD__ . " File size must be =" . $fileSize . "\n"; |
|
176 | + print __METHOD__." File size must be =".$fileSize."\n"; |
|
177 | 177 | $this->assertEquals(dol_filesize($localobject->html_images[$i]['fullpath']), $fileSize); |
178 | 178 | } elseif (preg_match('/\.png/i', $localobject->html_images[$i]['fullpath'])) { |
179 | - print __METHOD__ . " content type must be image png =" . $localobject->html_images[$i]['content_type'] . "\n"; |
|
179 | + print __METHOD__." content type must be image png =".$localobject->html_images[$i]['content_type']."\n"; |
|
180 | 180 | $this->assertEquals($localobject->html_images[$i]['content_type'], 'image/png'); |
181 | 181 | |
182 | - print __METHOD__ . " type must be cidfromdata =" . $localobject->html_images[$i]['type'] . "\n"; |
|
182 | + print __METHOD__." type must be cidfromdata =".$localobject->html_images[$i]['type']."\n"; |
|
183 | 183 | $this->assertEquals($localobject->html_images[$i]['type'], 'cidfromdata'); |
184 | 184 | |
185 | 185 | $fileSize = 85; |
186 | - print __METHOD__ . " File size must be =" . $fileSize . "\n"; |
|
186 | + print __METHOD__." File size must be =".$fileSize."\n"; |
|
187 | 187 | $this->assertEquals(dol_filesize($localobject->html_images[$i]['fullpath']), $fileSize); |
188 | 188 | } |
189 | 189 | } |