Passed
Push — dependabot/github_actions/mdew... ( c3a877 )
by
unknown
07:27
created
scripts/emailings/mailing-send.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -36,16 +36,16 @@  discard block
 block discarded – undo
36 36
 
37 37
 $sapi_type = php_sapi_name();
38 38
 $script_file = basename(__FILE__);
39
-$path = __DIR__ . '/';
39
+$path = __DIR__.'/';
40 40
 
41 41
 // Test if batch mode
42 42
 if (substr($sapi_type, 0, 3) == 'cgi') {
43
-    echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n";
43
+    echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
44 44
     exit(-1);
45 45
 }
46 46
 
47 47
 if (!isset($argv[1]) || !$argv[1]) {
48
-    print "Usage: " . $script_file . " (ID_MAILING|all) [userloginforsignature] [maxnbofemails]\n";
48
+    print "Usage: ".$script_file." (ID_MAILING|all) [userloginforsignature] [maxnbofemails]\n";
49 49
     exit(-1);
50 50
 }
51 51
 
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 }
65 65
 
66 66
 
67
-require_once $path . "../../htdocs/master.inc.php";
68
-require_once DOL_DOCUMENT_ROOT . "/core/class/CMailFile.class.php";
69
-require_once DOL_DOCUMENT_ROOT . "/comm/mailing/class/mailing.class.php";
67
+require_once $path."../../htdocs/master.inc.php";
68
+require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php";
69
+require_once DOL_DOCUMENT_ROOT."/comm/mailing/class/mailing.class.php";
70 70
 
71 71
 // Global variables
72 72
 $version = DOL_VERSION;
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
  */
92 92
 
93 93
 @set_time_limit(0);
94
-print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
94
+print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
95 95
 
96 96
 if (getDolGlobalInt('MAILING_DELAY')) {
97
-    print 'A delay of ' . ((float) getDolGlobalInt('MAILING_DELAY')) . ' seconds has been set between each email' . "\n";
97
+    print 'A delay of '.((float) getDolGlobalInt('MAILING_DELAY')).' seconds has been set between each email'."\n";
98 98
 }
99 99
 
100 100
 if (Functions::getDolGlobalString('MAILING_LIMIT_SENDBYCLI') == '-1') {
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 
114 114
 // We get list of emailing id to process
115 115
 $sql = "SELECT m.rowid";
116
-$sql .= " FROM " . MAIN_DB_PREFIX . "mailing as m";
116
+$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
117 117
 $sql .= " WHERE m.statut IN (1,2)";
118 118
 if ($id != 'all') {
119
-    $sql .= " AND m.rowid= " . ((int) $id);
119
+    $sql .= " AND m.rowid= ".((int) $id);
120 120
     $sql .= " LIMIT 1";
121 121
 }
122 122
 
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
         for ($j = 0; $j < $num; $j++) {
130 130
             $obj = $db->fetch_object($resql);
131 131
 
132
-            dol_syslog("Process mailing with id " . $obj->rowid);
133
-            print "Process mailing with id " . $obj->rowid . "\n";
132
+            dol_syslog("Process mailing with id ".$obj->rowid);
133
+            print "Process mailing with id ".$obj->rowid."\n";
134 134
 
135 135
             $emailing = new Mailing($db);
136 136
             $emailing->fetch($obj->rowid);
137 137
 
138
-            $upload_dir = $conf->mailing->dir_output . "/" . get_exdir($emailing->id, 2, 0, 1, $emailing, 'mailing');
138
+            $upload_dir = $conf->mailing->dir_output."/".get_exdir($emailing->id, 2, 0, 1, $emailing, 'mailing');
139 139
 
140 140
             $id = $emailing->id;
141 141
             $subject = $emailing->sujet;
@@ -155,27 +155,27 @@  discard block
 block discarded – undo
155 155
             // On choisit les mails non deja envoyes pour ce mailing (statut=0)
156 156
             // ou envoyes en erreur (statut=-1)
157 157
             $sql2 = "SELECT mc.rowid, mc.fk_mailing, mc.lastname, mc.firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag";
158
-            $sql2 .= " FROM " . MAIN_DB_PREFIX . "mailing_cibles as mc";
159
-            $sql2 .= " WHERE mc.statut < 1 AND mc.fk_mailing = " . ((int) $id);
158
+            $sql2 .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
159
+            $sql2 .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".((int) $id);
160 160
             if (getDolGlobalInt('MAILING_LIMIT_SENDBYCLI') > 0 && empty($max)) {
161
-                $sql2 .= " LIMIT " . Functions::getDolGlobalString('MAILING_LIMIT_SENDBYCLI');
161
+                $sql2 .= " LIMIT ".Functions::getDolGlobalString('MAILING_LIMIT_SENDBYCLI');
162 162
             } elseif (getDolGlobalInt('MAILING_LIMIT_SENDBYCLI') > 0 && $max > 0) {
163
-                $sql2 .= " LIMIT " . min(getDolGlobalInt('MAILING_LIMIT_SENDBYCLI'), $max);
163
+                $sql2 .= " LIMIT ".min(getDolGlobalInt('MAILING_LIMIT_SENDBYCLI'), $max);
164 164
             } elseif ($max > 0) {
165
-                $sql2 .= " LIMIT " . ((int) $max);
165
+                $sql2 .= " LIMIT ".((int) $max);
166 166
             }
167 167
 
168 168
             $resql2 = $db->query($sql2);
169 169
             if ($resql2) {
170 170
                 $num2 = $db->num_rows($resql2);
171
-                dol_syslog("Nb of targets = " . $num2, LOG_DEBUG);
172
-                print "Nb of targets = " . $num2 . "\n";
171
+                dol_syslog("Nb of targets = ".$num2, LOG_DEBUG);
172
+                print "Nb of targets = ".$num2."\n";
173 173
 
174 174
                 if ($num2) {
175 175
                     $now = dol_now();
176 176
 
177 177
                     // Positionne date debut envoi
178
-                    $sqlstartdate = "UPDATE " . MAIN_DB_PREFIX . "mailing SET date_envoi='" . $db->idate($now) . "' WHERE rowid=" . ((int) $id);
178
+                    $sqlstartdate = "UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi='".$db->idate($now)."' WHERE rowid=".((int) $id);
179 179
                     $resqlstartdate = $db->query($sqlstartdate);
180 180
                     if (!$resqlstartdate) {
181 181
                         dol_print_error($db);
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
                         $obj = $db->fetch_object($resql2);
195 195
 
196 196
                         // sendto en RFC2822
197
-                        $sendto = str_replace(',', ' ', dolGetFirstLastname($obj->firstname, $obj->lastname) . " <" . $obj->email . ">");
197
+                        $sendto = str_replace(',', ' ', dolGetFirstLastname($obj->firstname, $obj->lastname)." <".$obj->email.">");
198 198
 
199 199
                         // Make subtsitutions on topic and body
200 200
                         $other = explode(';', $obj->other);
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
                         $substitutionarray['__EMAIL__'] = $obj->email;
229 229
                         $substitutionarray['__LASTNAME__'] = $obj->lastname;
230 230
                         $substitutionarray['__FIRSTNAME__'] = $obj->firstname;
231
-                        $substitutionarray['__MAILTOEMAIL__'] = '<a href="mailto:' . $obj->email . '">' . $obj->email . '</a>';
231
+                        $substitutionarray['__MAILTOEMAIL__'] = '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>';
232 232
                         $substitutionarray['__OTHER1__'] = $other1;
233 233
                         $substitutionarray['__OTHER2__'] = $other2;
234 234
                         $substitutionarray['__OTHER3__'] = $other3;
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
                         $substitutionarray['__OTHER5__'] = $other5;
237 237
                         $substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter)
238 238
                         $substitutionarray['__SIGNATURE__'] = $signature; // For backward compatibility
239
-                        $substitutionarray['__CHECK_READ__'] = '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . urlencode($obj->tag) . '&securitykey=' . dol_hash(Functions::getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY') . "-" . $obj->tag . "-" . $obj->email . "-" . $obj->rowid, "md5") . '&email=' . urlencode($obj->email) . '&mtid=' . ((int) $obj->rowid) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>';
240
-                        $substitutionarray['__UNSUBSCRIBE__'] = '<a href="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-unsubscribe.php?tag=' . urlencode($obj->tag) . '&unsuscrib=1&securitykey=' . dol_hash(Functions::getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY') . "-" . $obj->tag . "-" . $obj->email . "-" . $obj->rowid, "md5") . '&email=' . urlencode($obj->email) . '&mtid=' . ((int) $obj->rowid) . '" target="_blank">' . $langs->trans("MailUnsubcribe") . '</a>';
241
-                        $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT . '/public/emailing/mailing-unsubscribe.php?tag=' . urlencode($obj->tag) . '&unsuscrib=1&securitykey=' . dol_hash(Functions::getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY') . "-" . $obj->tag . "-" . $obj->email . "-" . $obj->rowid, "md5") . '&email=' . urlencode($obj->email) . '&mtid=' . ((int) $obj->rowid);
239
+                        $substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.urlencode($obj->tag).'&securitykey='.dol_hash(Functions::getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')."-".$obj->tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid).'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
240
+                        $substitutionarray['__UNSUBSCRIBE__'] = '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.dol_hash(Functions::getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')."-".$obj->tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>';
241
+                        $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.dol_hash(Functions::getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')."-".$obj->tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid);
242 242
 
243 243
                         $onlinepaymentenabled = 0;
244 244
                         if (isModEnabled('paypal')) {
@@ -258,10 +258,10 @@  discard block
 block discarded – undo
258 258
                                 $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash(Functions::getDolGlobalString('PAYMENT_SECURITY_TOKEN'), 2);
259 259
                                 $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash(Functions::getDolGlobalString('PAYMENT_SECURITY_TOKEN'), 2);
260 260
                             } else {
261
-                                $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash(Functions::getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'membersubscription' . $obj->source_id, 2);
262
-                                $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash(Functions::getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'order' . $obj->source_id, 2);
263
-                                $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash(Functions::getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'invoice' . $obj->source_id, 2);
264
-                                $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash(Functions::getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'contractline' . $obj->source_id, 2);
261
+                                $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash(Functions::getDolGlobalString('PAYMENT_SECURITY_TOKEN').'membersubscription'.$obj->source_id, 2);
262
+                                $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash(Functions::getDolGlobalString('PAYMENT_SECURITY_TOKEN').'order'.$obj->source_id, 2);
263
+                                $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash(Functions::getDolGlobalString('PAYMENT_SECURITY_TOKEN').'invoice'.$obj->source_id, 2);
264
+                                $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash(Functions::getDolGlobalString('PAYMENT_SECURITY_TOKEN').'contractline'.$obj->source_id, 2);
265 265
                             }
266 266
                         }
267 267
                         /* For backward compatibility */
@@ -271,25 +271,25 @@  discard block
 block discarded – undo
271 271
                             if (!Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
272 272
                                 $substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash(Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN'), 2);
273 273
                             } else {
274
-                                $substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash(Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'membersubscription' . $obj->source_id, 2);
274
+                                $substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash(Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN').'membersubscription'.$obj->source_id, 2);
275 275
                             }
276 276
 
277 277
                             if (!Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
278 278
                                 $substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash(Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN'), 2);
279 279
                             } else {
280
-                                $substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash(Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'order' . $obj->source_id, 2);
280
+                                $substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash(Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN').'order'.$obj->source_id, 2);
281 281
                             }
282 282
 
283 283
                             if (!Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
284 284
                                 $substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash(Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN'), 2);
285 285
                             } else {
286
-                                $substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash(Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'invoice' . $obj->source_id, 2);
286
+                                $substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash(Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN').'invoice'.$obj->source_id, 2);
287 287
                             }
288 288
 
289 289
                             if (!Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
290 290
                                 $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash(Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN'), 2);
291 291
                             } else {
292
-                                $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash(Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'contractline' . $obj->source_id, 2);
292
+                                $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash(Functions::getDolGlobalString('PAYPAL_SECURITY_TOKEN').'contractline'.$obj->source_id, 2);
293 293
                             }
294 294
                         }
295 295
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
                             }
321 321
                         }
322 322
                         // Fabrication du mail
323
-                        $trackid = 'emailing-' . $obj->fk_mailing . '-' . $obj->rowid;
323
+                        $trackid = 'emailing-'.$obj->fk_mailing.'-'.$obj->rowid;
324 324
                         $upload_dir_tmp = $upload_dir;
325 325
                         $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing', '', $upload_dir_tmp);
326 326
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
                             // Mail successful
342 342
                             $nbok++;
343 343
 
344
-                            dol_syslog("ok for emailing id " . $id . " #" . $i . ($mail->error ? ' - ' . $mail->error : ''), LOG_DEBUG);
344
+                            dol_syslog("ok for emailing id ".$id." #".$i.($mail->error ? ' - '.$mail->error : ''), LOG_DEBUG);
345 345
 
346 346
                             // Note: If emailing is 100 000 targets, 100 000 entries are added, so we don't enter events for each target here
347 347
                             // We must union table llx_mailing_taget for event tab OR enter 1 event with a special table link (id of email in event)
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
                              * // End call triggers
362 362
                              */
363 363
 
364
-                            $sqlok = "UPDATE " . MAIN_DB_PREFIX . "mailing_cibles";
365
-                            $sqlok .= " SET statut = 1, date_envoi = '" . $db->idate($now) . "' WHERE rowid = " . ((int) $obj->rowid);
364
+                            $sqlok = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
365
+                            $sqlok .= " SET statut = 1, date_envoi = '".$db->idate($now)."' WHERE rowid = ".((int) $obj->rowid);
366 366
                             $resqlok = $db->query($sqlok);
367 367
                             if (!$resqlok) {
368 368
                                 dol_print_error($db);
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
                                 // if cheack read is use then update prospect contact status
372 372
                                 if (strpos($message, '__CHECK_READ__') !== false) {
373 373
                                     // Update status communication of thirdparty prospect
374
-                                    $sqlx = "UPDATE " . MAIN_DB_PREFIX . "societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM " . MAIN_DB_PREFIX . "mailing_cibles WHERE rowid=" . ((int) $obj->rowid) . ")";
374
+                                    $sqlx = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".((int) $obj->rowid).")";
375 375
                                     dol_syslog("card.php: set prospect thirdparty status", LOG_DEBUG);
376 376
                                     $resqlx = $db->query($sqlx);
377 377
                                     if (!$resqlx) {
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
                                     }
381 381
 
382 382
                                     // Update status communication of contact prospect
383
-                                    $sqlx = "UPDATE " . MAIN_DB_PREFIX . "societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "socpeople AS sc INNER JOIN " . MAIN_DB_PREFIX . "mailing_cibles AS mc ON mc.rowid=" . ((int) $obj->rowid) . " AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
383
+                                    $sqlx = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".((int) $obj->rowid)." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
384 384
                                     dol_syslog("card.php: set prospect contact status", LOG_DEBUG);
385 385
 
386 386
                                     $resqlx = $db->query($sqlx);
@@ -398,10 +398,10 @@  discard block
 block discarded – undo
398 398
                             // Mail failed
399 399
                             $nbko++;
400 400
 
401
-                            dol_syslog("error for emailing id " . $id . " #" . $i . ($mail->error ? ' - ' . $mail->error : ''), LOG_DEBUG);
401
+                            dol_syslog("error for emailing id ".$id." #".$i.($mail->error ? ' - '.$mail->error : ''), LOG_DEBUG);
402 402
 
403
-                            $sqlerror = "UPDATE " . MAIN_DB_PREFIX . "mailing_cibles";
404
-                            $sqlerror .= " SET statut=-1, date_envoi='" . $db->idate($now) . "' WHERE rowid=" . $obj->rowid;
403
+                            $sqlerror = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
404
+                            $sqlerror .= " SET statut=-1, date_envoi='".$db->idate($now)."' WHERE rowid=".$obj->rowid;
405 405
                             $resqlerror = $db->query($sqlerror);
406 406
                             if (!$resqlerror) {
407 407
                                 dol_print_error($db);
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
                         $i++;
413 413
                     }
414 414
                 } else {
415
-                    $mesg = "Emailing id " . $id . " has no recipient to target";
416
-                    print $mesg . "\n";
415
+                    $mesg = "Emailing id ".$id." has no recipient to target";
416
+                    print $mesg."\n";
417 417
                     dol_syslog($mesg, LOG_ERR);
418 418
                 }
419 419
 
@@ -423,10 +423,10 @@  discard block
 block discarded – undo
423 423
                     $statut = 3;
424 424
                 }
425 425
 
426
-                $sqlenddate = "UPDATE " . MAIN_DB_PREFIX . "mailing SET statut=" . ((int) $statut) . " WHERE rowid=" . ((int) $id);
426
+                $sqlenddate = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".((int) $statut)." WHERE rowid=".((int) $id);
427 427
 
428 428
                 dol_syslog("update global status", LOG_DEBUG);
429
-                print "Update status of emailing id " . $id . " to " . $statut . "\n";
429
+                print "Update status of emailing id ".$id." to ".$statut."\n";
430 430
                 $resqlenddate = $db->query($sqlenddate);
431 431
                 if (!$resqlenddate) {
432 432
                     dol_print_error($db);
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
         }
440 440
     } else {
441 441
         $mesg = "No validated emailing id to send found.";
442
-        print $mesg . "\n";
442
+        print $mesg."\n";
443 443
         dol_syslog($mesg, LOG_ERR);
444 444
         $error++;
445 445
     }
Please login to merge, or discard this patch.
scripts/user/sync_groups_ldap2dolibarr.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
 
36 36
 $sapi_type = php_sapi_name();
37 37
 $script_file = basename(__FILE__);
38
-$path = __DIR__ . '/';
38
+$path = __DIR__.'/';
39 39
 
40 40
 // Test if batch mode
41 41
 if (substr($sapi_type, 0, 3) == 'cgi') {
42
-    echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n";
42
+    echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
43 43
     exit(-1);
44 44
 }
45 45
 
46
-require_once $path . "../../htdocs/master.inc.php";
47
-require_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php";
48
-require_once DOL_DOCUMENT_ROOT . "/core/class/ldap.class.php";
49
-require_once DOL_DOCUMENT_ROOT . "/user/class/user.class.php";
50
-require_once DOL_DOCUMENT_ROOT . "/user/class/usergroup.class.php";
46
+require_once $path."../../htdocs/master.inc.php";
47
+require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
48
+require_once DOL_DOCUMENT_ROOT."/core/class/ldap.class.php";
49
+require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php";
50
+require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php";
51 51
 
52 52
 $langs->loadLangs(array("main", "errors"));
53 53
 
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
  */
66 66
 
67 67
 @set_time_limit(0);
68
-print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
69
-dol_syslog($script_file . " launched with arg " . join(',', $argv));
68
+print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
69
+dol_syslog($script_file." launched with arg ".join(',', $argv));
70 70
 
71 71
 // List of fields to get from LDAP
72 72
 $required_fields = array(Functions::getDolGlobalString('LDAP_KEY_GROUPS'), Functions::getDolGlobalString('LDAP_GROUP_FIELD_FULLNAME'), Functions::getDolGlobalString('LDAP_GROUP_FIELD_DESCRIPTION'), Functions::getDolGlobalString('LDAP_GROUP_FIELD_GROUPMEMBERS'));
@@ -99,25 +99,25 @@  discard block
 block discarded – undo
99 99
 $conf->global->MAIN_DISABLE_ALL_MAILS = 1; // On bloque les mails
100 100
 print "\n";
101 101
 print "----- Synchronize all records from LDAP database:\n";
102
-print "host=" . Functions::getDolGlobalString('LDAP_SERVER_HOST') . "\n";
103
-print "port=" . Functions::getDolGlobalString('LDAP_SERVER_PORT') . "\n";
104
-print "login=" . Functions::getDolGlobalString('LDAP_ADMIN_DN') . "\n";
105
-print "pass=" . preg_replace('/./i', '*', Functions::getDolGlobalString('LDAP_ADMIN_PASS')) . "\n";
106
-print "DN to extract=" . Functions::getDolGlobalString('LDAP_GROUP_DN') . "\n";
102
+print "host=".Functions::getDolGlobalString('LDAP_SERVER_HOST')."\n";
103
+print "port=".Functions::getDolGlobalString('LDAP_SERVER_PORT')."\n";
104
+print "login=".Functions::getDolGlobalString('LDAP_ADMIN_DN')."\n";
105
+print "pass=".preg_replace('/./i', '*', Functions::getDolGlobalString('LDAP_ADMIN_PASS'))."\n";
106
+print "DN to extract=".Functions::getDolGlobalString('LDAP_GROUP_DN')."\n";
107 107
 if (Functions::getDolGlobalString('LDAP_GROUP_FILTER')) {
108
-    print 'Filter=(' . Functions::getDolGlobalString('LDAP_GROUP_FILTER') . ')' . "\n"; // Note: filter is defined into function getRecords
108
+    print 'Filter=('.Functions::getDolGlobalString('LDAP_GROUP_FILTER').')'."\n"; // Note: filter is defined into function getRecords
109 109
 } else {
110
-    print 'Filter=(' . Functions::getDolGlobalString('LDAP_KEY_GROUPS') . '=*)' . "\n";
110
+    print 'Filter=('.Functions::getDolGlobalString('LDAP_KEY_GROUPS').'=*)'."\n";
111 111
 }
112 112
 print "----- To Dolibarr database:\n";
113
-print "type=" . $conf->db->type . "\n";
114
-print "host=" . $conf->db->host . "\n";
115
-print "port=" . $conf->db->port . "\n";
116
-print "login=" . $conf->db->user . "\n";
117
-print "database=" . $conf->db->name . "\n";
113
+print "type=".$conf->db->type."\n";
114
+print "host=".$conf->db->host."\n";
115
+print "port=".$conf->db->port."\n";
116
+print "login=".$conf->db->user."\n";
117
+print "database=".$conf->db->name."\n";
118 118
 print "----- Options:\n";
119
-print "commitiferror=" . $forcecommit . "\n";
120
-print "Mapped LDAP fields=" . join(',', $required_fields) . "\n";
119
+print "commitiferror=".$forcecommit."\n";
120
+print "Mapped LDAP fields=".join(',', $required_fields)."\n";
121 121
 print "\n";
122 122
 
123 123
 if (!$confirmed) {
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 }
127 127
 
128 128
 if (!Functions::getDolGlobalString('LDAP_GROUP_DN')) {
129
-    print $langs->trans("Error") . ': ' . $langs->trans("LDAP setup for groups not defined inside Dolibarr");
129
+    print $langs->trans("Error").': '.$langs->trans("LDAP setup for groups not defined inside Dolibarr");
130 130
     exit(-1);
131 131
 }
132 132
 
@@ -154,25 +154,25 @@  discard block
 block discarded – undo
154 154
             // print_r($ldapgroup);
155 155
 
156 156
             if ($group->id > 0) { // Group update
157
-                print $langs->transnoentities("GroupUpdate") . ' # ' . $key . ': name=' . $group->name;
157
+                print $langs->transnoentities("GroupUpdate").' # '.$key.': name='.$group->name;
158 158
                 $res = $group->update();
159 159
 
160 160
                 if ($res > 0) {
161
-                    print ' --> Updated group id=' . $group->id . ' name=' . $group->name;
161
+                    print ' --> Updated group id='.$group->id.' name='.$group->name;
162 162
                 } else {
163 163
                     $error++;
164
-                    print ' --> ' . $res . ' ' . $group->error;
164
+                    print ' --> '.$res.' '.$group->error;
165 165
                 }
166 166
                 print "\n";
167 167
             } else { // Group creation
168
-                print $langs->transnoentities("GroupCreate") . ' # ' . $key . ': name=' . $group->name;
168
+                print $langs->transnoentities("GroupCreate").' # '.$key.': name='.$group->name;
169 169
                 $res = $group->create();
170 170
 
171 171
                 if ($res > 0) {
172
-                    print ' --> Created group id=' . $group->id . ' name=' . $group->name;
172
+                    print ' --> Created group id='.$group->id.' name='.$group->name;
173 173
                 } else {
174 174
                     $error++;
175
-                    print ' --> ' . $res . ' ' . $group->error;
175
+                    print ' --> '.$res.' '.$group->error;
176 176
                 }
177 177
                 print "\n";
178 178
             }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
                         $userKey = array($userdn);
194 194
                     } else { // Pour les autres schémas, les membres sont listés sous forme de DN completes
195 195
                         $userFilter = explode(',', $userdn);
196
-                        $userKey = $ldap->getAttributeValues('(' . $userFilter[0] . ')', Functions::getDolGlobalString('LDAP_KEY_USERS'));
196
+                        $userKey = $ldap->getAttributeValues('('.$userFilter[0].')', Functions::getDolGlobalString('LDAP_KEY_USERS'));
197 197
                     }
198 198
                     if (!is_array($userKey)) {
199 199
                         continue;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
                 // Add the user in the group
218 218
                 if (!in_array($fuser->id, array_keys($group->members))) {
219 219
                     $fuser->SetInGroup($group->id, $group->entity);
220
-                    echo $fuser->login . ' added' . "\n";
220
+                    echo $fuser->login.' added'."\n";
221 221
                 }
222 222
             }
223 223
 
@@ -225,20 +225,20 @@  discard block
 block discarded – undo
225 225
             foreach ($group->members as $guser) {
226 226
                 if (!in_array($guser->id, $userIdList)) {
227 227
                     $guser->RemoveFromGroup($group->id, $group->entity);
228
-                    echo $guser->login . ' removed' . "\n";
228
+                    echo $guser->login.' removed'."\n";
229 229
                 }
230 230
             }
231 231
         }
232 232
 
233 233
         if (!$error || $forcecommit) {
234 234
             if (!$error) {
235
-                print $langs->transnoentities("NoErrorCommitIsDone") . "\n";
235
+                print $langs->transnoentities("NoErrorCommitIsDone")."\n";
236 236
             } else {
237
-                print $langs->transnoentities("ErrorButCommitIsDone") . "\n";
237
+                print $langs->transnoentities("ErrorButCommitIsDone")."\n";
238 238
             }
239 239
             $db->commit();
240 240
         } else {
241
-            print $langs->transnoentities("ErrorSomeErrorWereFoundRollbackIsDone", $error) . "\n";
241
+            print $langs->transnoentities("ErrorSomeErrorWereFoundRollbackIsDone", $error)."\n";
242 242
             $db->rollback();
243 243
         }
244 244
         print "\n";
Please login to merge, or discard this patch.
scripts/user/sync_groups_dolibarr2ldap.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -34,23 +34,23 @@  discard block
 block discarded – undo
34 34
 
35 35
 $sapi_type = php_sapi_name();
36 36
 $script_file = basename(__FILE__);
37
-$path = __DIR__ . '/';
37
+$path = __DIR__.'/';
38 38
 
39 39
 // Test if batch mode
40 40
 if (substr($sapi_type, 0, 3) == 'cgi') {
41
-    echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n";
41
+    echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
42 42
     exit(-1);
43 43
 }
44 44
 
45 45
 if (!isset($argv[1]) || !$argv[1]) {
46
-    print "Usage: " . $script_file . " now\n";
46
+    print "Usage: ".$script_file." now\n";
47 47
     exit(-1);
48 48
 }
49 49
 $now = $argv[1];
50 50
 
51
-require_once $path . "../../htdocs/master.inc.php";
52
-require_once DOL_DOCUMENT_ROOT . "/core/class/ldap.class.php";
53
-require_once DOL_DOCUMENT_ROOT . "/user/class/usergroup.class.php";
51
+require_once $path."../../htdocs/master.inc.php";
52
+require_once DOL_DOCUMENT_ROOT."/core/class/ldap.class.php";
53
+require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php";
54 54
 
55 55
 // Global variables
56 56
 $version = DOL_VERSION;
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
  */
65 65
 
66 66
 @set_time_limit(0);
67
-print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
68
-dol_syslog($script_file . " launched with arg " . join(',', $argv));
67
+print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
68
+dol_syslog($script_file." launched with arg ".join(',', $argv));
69 69
 
70 70
 /*
71 71
  * if (Functions::getDolGlobalString('LDAP_SYNCHRO_ACTIVE')) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
  */
76 76
 
77 77
 $sql = "SELECT rowid";
78
-$sql .= " FROM " . MAIN_DB_PREFIX . "usergroup";
78
+$sql .= " FROM ".MAIN_DB_PREFIX."usergroup";
79 79
 
80 80
 $resql = $db->query($sql);
81 81
 if ($resql) {
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $fgroup->id = $obj->rowid;
95 95
         $fgroup->fetch($fgroup->id);
96 96
 
97
-        print $langs->trans("UpdateGroup") . " rowid=" . $fgroup->id . " " . $fgroup->name;
97
+        print $langs->trans("UpdateGroup")." rowid=".$fgroup->id." ".$fgroup->name;
98 98
 
99 99
         $oldobject = $fgroup;
100 100
 
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
         $result = $ldap->add($dn, $info, $user); // Will fail if already exists
108 108
         $result = $ldap->update($dn, $info, $user, $olddn);
109 109
         if ($result > 0) {
110
-            print " - " . $langs->trans("OK");
110
+            print " - ".$langs->trans("OK");
111 111
         } else {
112 112
             $error++;
113
-            print " - " . $langs->trans("KO") . ' - ' . $ldap->error;
113
+            print " - ".$langs->trans("KO").' - '.$ldap->error;
114 114
         }
115 115
         print "\n";
116 116
 
Please login to merge, or discard this patch.
scripts/user/sync_users_dolibarr2ldap.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 
35 35
 $sapi_type = php_sapi_name();
36 36
 $script_file = basename(__FILE__);
37
-$path = __DIR__ . '/';
37
+$path = __DIR__.'/';
38 38
 
39 39
 // Test if batch mode
40 40
 if (substr($sapi_type, 0, 3) == 'cgi') {
41
-    echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n";
41
+    echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
42 42
     exit(-1);
43 43
 }
44 44
 
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 }
49 49
 $now = $argv[1];
50 50
 
51
-require_once $path . "../../htdocs/master.inc.php";
52
-require_once DOL_DOCUMENT_ROOT . "/core/class/ldap.class.php";
53
-require_once DOL_DOCUMENT_ROOT . "/user/class/user.class.php";
51
+require_once $path."../../htdocs/master.inc.php";
52
+require_once DOL_DOCUMENT_ROOT."/core/class/ldap.class.php";
53
+require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php";
54 54
 
55 55
 // Global variables
56 56
 $version = DOL_VERSION;
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
  */
65 65
 
66 66
 @set_time_limit(0);
67
-print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
68
-dol_syslog($script_file . " launched with arg " . join(',', $argv));
67
+print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
68
+dol_syslog($script_file." launched with arg ".join(',', $argv));
69 69
 
70 70
 /*
71 71
  * if (! Functions::getDolGlobalString('LDAP_SYNCHRO_ACTIVE')) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
  */
76 76
 
77 77
 $sql = "SELECT rowid";
78
-$sql .= " FROM " . MAIN_DB_PREFIX . "user";
78
+$sql .= " FROM ".MAIN_DB_PREFIX."user";
79 79
 
80 80
 $resql = $db->query($sql);
81 81
 if ($resql) {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         $fuser = new User($db);
94 94
         $fuser->fetch($obj->rowid);
95 95
 
96
-        print $langs->trans("UpdateUser") . " rowid=" . $fuser->id . " " . $fuser->getFullName($langs);
96
+        print $langs->trans("UpdateUser")." rowid=".$fuser->id." ".$fuser->getFullName($langs);
97 97
 
98 98
         $oldobject = $fuser;
99 99
 
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
         $result = $ldap->add($dn, $info, $user); // Will fail if already exists
107 107
         $result = $ldap->update($dn, $info, $user, $olddn);
108 108
         if ($result > 0) {
109
-            print " - " . $langs->trans("OK");
109
+            print " - ".$langs->trans("OK");
110 110
         } else {
111 111
             $error++;
112
-            print " - " . $langs->trans("KO") . ' - ' . $ldap->error;
112
+            print " - ".$langs->trans("KO").' - '.$ldap->error;
113 113
         }
114 114
         print "\n";
115 115
 
Please login to merge, or discard this patch.
scripts/user/sync_users_ldap2dolibarr.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -34,18 +34,18 @@  discard block
 block discarded – undo
34 34
 
35 35
 $sapi_type = php_sapi_name();
36 36
 $script_file = basename(__FILE__);
37
-$path = __DIR__ . '/';
37
+$path = __DIR__.'/';
38 38
 
39 39
 // Test if batch mode
40 40
 if (substr($sapi_type, 0, 3) == 'cgi') {
41
-    echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n";
41
+    echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
42 42
     exit(-1);
43 43
 }
44 44
 
45
-require_once $path . "../../htdocs/master.inc.php";
46
-require_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php";
47
-require_once DOL_DOCUMENT_ROOT . "/core/class/ldap.class.php";
48
-require_once DOL_DOCUMENT_ROOT . "/user/class/user.class.php";
45
+require_once $path."../../htdocs/master.inc.php";
46
+require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
47
+require_once DOL_DOCUMENT_ROOT."/core/class/ldap.class.php";
48
+require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php";
49 49
 
50 50
 $langs->loadLangs(array("main", "errors"));
51 51
 
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
  */
65 65
 
66 66
 @set_time_limit(0);
67
-print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
68
-dol_syslog($script_file . " launched with arg " . join(',', $argv));
67
+print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
68
+dol_syslog($script_file." launched with arg ".join(',', $argv));
69 69
 
70 70
 // List of fields to get from LDAP
71 71
 $required_fields = array(
@@ -117,26 +117,26 @@  discard block
 block discarded – undo
117 117
 $conf->global->MAIN_DISABLE_ALL_MAILS = 1; // On bloque les mails
118 118
 print "\n";
119 119
 print "----- Synchronize all records from LDAP database:\n";
120
-print "host=" . Functions::getDolGlobalString('LDAP_SERVER_HOST') . "\n";
121
-print "port=" . Functions::getDolGlobalString('LDAP_SERVER_PORT') . "\n";
122
-print "login=" . Functions::getDolGlobalString('LDAP_ADMIN_DN') . "\n";
123
-print "pass=" . preg_replace('/./i', '*', Functions::getDolGlobalString('LDAP_ADMIN_PASS')) . "\n";
124
-print "DN to extract=" . Functions::getDolGlobalString('LDAP_USER_DN') . "\n";
120
+print "host=".Functions::getDolGlobalString('LDAP_SERVER_HOST')."\n";
121
+print "port=".Functions::getDolGlobalString('LDAP_SERVER_PORT')."\n";
122
+print "login=".Functions::getDolGlobalString('LDAP_ADMIN_DN')."\n";
123
+print "pass=".preg_replace('/./i', '*', Functions::getDolGlobalString('LDAP_ADMIN_PASS'))."\n";
124
+print "DN to extract=".Functions::getDolGlobalString('LDAP_USER_DN')."\n";
125 125
 if (Functions::getDolGlobalString('LDAP_FILTER_CONNECTION')) {
126
-    print 'Filter=(' . Functions::getDolGlobalString('LDAP_FILTER_CONNECTION') . ')' . "\n"; // Note: filter is defined into function getRecords
126
+    print 'Filter=('.Functions::getDolGlobalString('LDAP_FILTER_CONNECTION').')'."\n"; // Note: filter is defined into function getRecords
127 127
 } else {
128
-    print 'Filter=(' . Functions::getDolGlobalString('LDAP_KEY_USERS') . '=*)' . "\n";
128
+    print 'Filter=('.Functions::getDolGlobalString('LDAP_KEY_USERS').'=*)'."\n";
129 129
 }
130 130
 print "----- To Dolibarr database:\n";
131
-print "type=" . $conf->db->type . "\n";
132
-print "host=" . $conf->db->host . "\n";
133
-print "port=" . $conf->db->port . "\n";
134
-print "login=" . $conf->db->user . "\n";
135
-print "database=" . $conf->db->name . "\n";
131
+print "type=".$conf->db->type."\n";
132
+print "host=".$conf->db->host."\n";
133
+print "port=".$conf->db->port."\n";
134
+print "login=".$conf->db->user."\n";
135
+print "database=".$conf->db->name."\n";
136 136
 print "----- Options:\n";
137
-print "commitiferror=" . $forcecommit . "\n";
138
-print "excludeuser=" . join(',', $excludeuser) . "\n";
139
-print "Mapped LDAP fields=" . join(',', $required_fields) . "\n";
137
+print "commitiferror=".$forcecommit."\n";
138
+print "excludeuser=".join(',', $excludeuser)."\n";
139
+print "Mapped LDAP fields=".join(',', $required_fields)."\n";
140 140
 print "\n";
141 141
 
142 142
 if (!$confirmed) {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 }
146 146
 
147 147
 if (!Functions::getDolGlobalString('LDAP_USER_DN')) {
148
-    print $langs->trans("Error") . ': ' . $langs->trans("LDAP setup for users not defined inside Dolibarr");
148
+    print $langs->trans("Error").': '.$langs->trans("LDAP setup for users not defined inside Dolibarr");
149 149
     exit(-1);
150 150
 }
151 151
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 $hashlib2rowid = array();
154 154
 $countries = array();
155 155
 $sql = "SELECT rowid, code, label, active";
156
-$sql .= " FROM " . MAIN_DB_PREFIX . "c_country";
156
+$sql .= " FROM ".MAIN_DB_PREFIX."c_country";
157 157
 $sql .= " WHERE active = 1";
158 158
 $sql .= " ORDER BY code ASC";
159 159
 $resql = $db->query($sql);
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         foreach ($ldaprecords as $key => $ldapuser) {
193 193
             // If login into exclude list, we discard record
194 194
             if (in_array($ldapuser[Functions::getDolGlobalString('LDAP_FIELD_LOGIN')], $excludeuser)) {
195
-                print $langs->transnoentities("UserDiscarded") . ' # ' . $key . ': login=' . $ldapuser[Functions::getDolGlobalString('LDAP_FIELD_LOGIN')] . ' --> Discarded' . "\n";
195
+                print $langs->transnoentities("UserDiscarded").' # '.$key.': login='.$ldapuser[Functions::getDolGlobalString('LDAP_FIELD_LOGIN')].' --> Discarded'."\n";
196 196
                 continue;
197 197
             }
198 198
 
@@ -248,24 +248,24 @@  discard block
 block discarded – undo
248 248
             // print_r($ldapuser);
249 249
 
250 250
             if ($fuser->id > 0) { // User update
251
-                print $langs->transnoentities("UserUpdate") . ' # ' . $key . ': login=' . $fuser->login . ', fullname=' . $fuser->getFullName($langs);
251
+                print $langs->transnoentities("UserUpdate").' # '.$key.': login='.$fuser->login.', fullname='.$fuser->getFullName($langs);
252 252
                 $res = $fuser->update($user);
253 253
 
254 254
                 if ($res < 0) {
255 255
                     $error++;
256
-                    print ' --> ' . $res . ' ' . $fuser->error;
256
+                    print ' --> '.$res.' '.$fuser->error;
257 257
                 } else {
258
-                    print ' --> Updated user id=' . $fuser->id . ' login=' . $fuser->login;
258
+                    print ' --> Updated user id='.$fuser->id.' login='.$fuser->login;
259 259
                 }
260 260
             } else { // User creation
261
-                print $langs->transnoentities("UserCreate") . ' # ' . $key . ': login=' . $fuser->login . ', fullname=' . $fuser->getFullName($langs);
261
+                print $langs->transnoentities("UserCreate").' # '.$key.': login='.$fuser->login.', fullname='.$fuser->getFullName($langs);
262 262
                 $res = $fuser->create($user);
263 263
 
264 264
                 if ($res > 0) {
265
-                    print ' --> Created user id=' . $fuser->id . ' login=' . $fuser->login;
265
+                    print ' --> Created user id='.$fuser->id.' login='.$fuser->login;
266 266
                 } else {
267 267
                     $error++;
268
-                    print ' --> ' . $res . ' ' . $fuser->error;
268
+                    print ' --> '.$res.' '.$fuser->error;
269 269
                 }
270 270
             }
271 271
             print "\n";
@@ -284,13 +284,13 @@  discard block
 block discarded – undo
284 284
 
285 285
         if (!$error || $forcecommit) {
286 286
             if (!$error) {
287
-                print $langs->transnoentities("NoErrorCommitIsDone") . "\n";
287
+                print $langs->transnoentities("NoErrorCommitIsDone")."\n";
288 288
             } else {
289
-                print $langs->transnoentities("ErrorButCommitIsDone") . "\n";
289
+                print $langs->transnoentities("ErrorButCommitIsDone")."\n";
290 290
             }
291 291
             $db->commit();
292 292
         } else {
293
-            print $langs->transnoentities("ErrorSomeErrorWereFoundRollbackIsDone", $error) . "\n";
293
+            print $langs->transnoentities("ErrorSomeErrorWereFoundRollbackIsDone", $error)."\n";
294 294
             $db->rollback();
295 295
         }
296 296
         print "\n";
Please login to merge, or discard this patch.
htdocs/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 }
49 49
 
50 50
 $pageName = str_replace('/', '\\', $page);
51
-$namespace = 'Alixar\\' . $pageName . '\\' . $ctrl;
51
+$namespace = 'Alixar\\'.$pageName.'\\'.$ctrl;
52 52
 
53 53
 $controller = new $namespace();
54 54
 $controller->view();
55 55
\ No newline at end of file
Please login to merge, or discard this patch.
websites/website_template-onepageblackpurple/containers/manifest.json.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php // BEGIN PHP
2 2
 $websitekey = basename(__DIR__);
3
-if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once __DIR__ . '/master.inc.php'; 
3
+if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) { require_once __DIR__.'/master.inc.php'; 
4 4
 } // Load env if not already loaded
5
-require_once DOL_DOCUMENT_ROOT . '/core/lib/website.lib.php';
6
-require_once DOL_DOCUMENT_ROOT . '/core/website.inc.php';
5
+require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';
6
+require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';
7 7
 ob_start();
8 8
 header('Cache-Control: max-age=3600, public, must-revalidate');
9 9
 header('Content-type: application/manifest+json');
Please login to merge, or discard this patch.
websites/website_template-onepageblackpurple/containers/master.inc.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // File generated to link to the master file - DO NOT MODIFY - It is just an include
4
-if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) {
5
-    if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1);
4
+if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) {
5
+    if (!defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1);
6 6
     require_once '/var/www/html/dolibarr_dev/htdocs/master.inc.php';
7 7
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,6 +2,8 @@
 block discarded – undo
2 2
 
3 3
 // File generated to link to the master file - DO NOT MODIFY - It is just an include
4 4
 if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) {
5
-    if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1);
5
+    if (! defined('USEEXTERNALSERVER')) {
6
+        define('USEEXTERNALSERVER', 1);
7
+    }
6 8
     require_once '/var/www/html/dolibarr_dev/htdocs/master.inc.php';
7 9
 }
Please login to merge, or discard this patch.
websites/website_template-onepageblackpurple/containers/wrapper.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) {
9 9
     require_once './master.inc.php';
10 10
 } // Load master if not already loaded
11
-include_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
11
+include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
12 12
 
13 13
 $encoding = '';
14 14
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 // If we have a hash public (hashp), we guess the original_file.
30 30
 if (!empty($hashp)) {
31
-    include_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php';
31
+    include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
32 32
     $ecmfile = new EcmFiles($db);
33 33
     $result = $ecmfile->fetch(0, '', '', '', $hashp);
34 34
     if ($result > 0) {
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
         if ($modulepart) {  // Not required, so often not defined, for link using public hashp parameter.
43 43
             if ($moduleparttocheck == $modulepart) {
44 44
                 // We remove first level of directory
45
-                $original_file = (($tmp[1] ? $tmp[1] . '/' : '') . $ecmfile->filename); // this is relative to module dir
45
+                $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir
46 46
                 //var_dump($original_file); exit;
47 47
             } else {
48 48
                 print 'Bad link. File is from another module part.';
49 49
             }
50 50
         } else {
51 51
             $modulepart = $moduleparttocheck;
52
-            $original_file = (($tmp[1] ? $tmp[1] . '/' : '') . $ecmfile->filename); // this is relative to module dir
52
+            $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir
53 53
         }
54 54
     } else {
55 55
         print "ErrorFileNotFoundWithSharedLink";
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     header('Pragma: cache'); // This is to avoid having Pragma: no-cache
89 89
 }
90 90
 
91
-$refname = basename(dirname($original_file) . "/");
91
+$refname = basename(dirname($original_file)."/");
92 92
 
93 93
 // Get RSS news
94 94
 if ($rss) {
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
     $filename = $original_file;
99 99
     $dir_temp = $conf->website->dir_temp;
100 100
 
101
-    include_once DOL_DOCUMENT_ROOT . '/website/class/website.class.php';
102
-    include_once DOL_DOCUMENT_ROOT . '/website/class/websitepage.class.php';
101
+    include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
102
+    include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
103 103
     $website = new Website($db);
104 104
     $websitepage = new WebsitePage($db);
105 105
 
@@ -115,26 +115,26 @@  discard block
 block discarded – undo
115 115
     $eventarray = array();
116 116
     if (is_array($arrayofblogs)) {
117 117
         foreach ($arrayofblogs as $blog) {
118
-            $blog->fullpageurl = $website->virtualhost . '/' . $blog->pageurl . '.php';
118
+            $blog->fullpageurl = $website->virtualhost.'/'.$blog->pageurl.'.php';
119 119
             $eventarray[] = $blog;
120 120
         }
121 121
     }
122 122
 
123
-    require_once DOL_DOCUMENT_ROOT . "/core/lib/xcal.lib.php";
124
-    require_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php";
125
-    require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
123
+    require_once DOL_DOCUMENT_ROOT."/core/lib/xcal.lib.php";
124
+    require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
125
+    require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
126 126
 
127
-    dol_syslog("build_exportfile Build export file format=" . $format . ", type=" . $type . ", cachedelay=" . $cachedelay . ", filename=" . $filename . ", filters size=" . count($filters), LOG_DEBUG);
127
+    dol_syslog("build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG);
128 128
 
129 129
     // Clean parameters
130 130
     if (!$filename) {
131 131
         $extension = 'rss';
132
-        $filename = $format . '.' . $extension;
132
+        $filename = $format.'.'.$extension;
133 133
     }
134 134
 
135 135
     // Create dir and define output file (definitive and temporary)
136 136
     $result = dol_mkdir($dir_temp);
137
-    $outputfile = $dir_temp . '/' . $filename;
137
+    $outputfile = $dir_temp.'/'.$filename;
138 138
 
139 139
     $result = 0;
140 140
 
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 
143 143
     if ($cachedelay) {
144 144
         $nowgmt = dol_now();
145
-        include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
145
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
146 146
         if (dol_filemtime($outputfile) > ($nowgmt - $cachedelay)) {
147
-            dol_syslog("build_exportfile file " . $outputfile . " is not older than now - cachedelay (" . $nowgmt . " - " . $cachedelay . "). Build is canceled");
147
+            dol_syslog("build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled");
148 148
             $buildfile = false;
149 149
         }
150 150
     }
@@ -160,20 +160,20 @@  discard block
 block discarded – undo
160 160
         dolChmod($outputfiletmp);
161 161
 
162 162
         // Write file
163
-        $result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost . '/wrapper.php?rss=1' . ($l ? '&l=' . $l : ''), $l);
163
+        $result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'.($l ? '&l='.$l : ''), $l);
164 164
 
165 165
         if ($result >= 0) {
166 166
             if (dol_move($outputfiletmp, $outputfile, 0, 1, 0, 0)) {
167 167
                 $result = 1;
168 168
             } else {
169
-                $error = 'Failed to rename ' . $outputfiletmp . ' into ' . $outputfile;
170
-                dol_syslog("build_exportfile " . $error, LOG_ERR);
169
+                $error = 'Failed to rename '.$outputfiletmp.' into '.$outputfile;
170
+                dol_syslog("build_exportfile ".$error, LOG_ERR);
171 171
                 dol_delete_file($outputfiletmp, 0, 1);
172 172
                 print $error;
173 173
                 exit(-1);
174 174
             }
175 175
         } else {
176
-            dol_syslog("build_exportfile build_xxxfile function fails to for format=" . $format . " outputfiletmp=" . $outputfile, LOG_ERR);
176
+            dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR);
177 177
             dol_delete_file($outputfiletmp, 0, 1);
178 178
             $langs->load("errors");
179 179
             print $langs->trans("ErrorFailToCreateFile", $outputfile);
@@ -195,26 +195,26 @@  discard block
 block discarded – undo
195 195
         $outputencoding = 'UTF-8';
196 196
 
197 197
         if ($contenttype) {
198
-            header('Content-Type: ' . $contenttype . ($outputencoding ? '; charset=' . $outputencoding : ''));
198
+            header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : ''));
199 199
         }
200 200
         if ($attachment) {
201
-            header('Content-Disposition: attachment; filename="' . $filename . '"');
201
+            header('Content-Disposition: attachment; filename="'.$filename.'"');
202 202
         }
203 203
 
204 204
         // Ajout directives pour resoudre bug IE
205 205
         //header('Cache-Control: Public, must-revalidate');
206 206
         //header('Pragma: public');
207 207
         if ($cachedelay) {
208
-            header('Cache-Control: max-age=' . $cachedelay . ', private, must-revalidate');
208
+            header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate');
209 209
         } else {
210 210
             header('Cache-Control: private, must-revalidate');
211 211
         }
212 212
 
213 213
         // Clean parameters
214
-        $outputfile = $dir_temp . '/' . $filename;
214
+        $outputfile = $dir_temp.'/'.$filename;
215 215
         $result = readfile($outputfile);
216 216
         if (!$result) {
217
-            print 'File ' . $outputfile . ' was empty.';
217
+            print 'File '.$outputfile.' was empty.';
218 218
         }
219 219
 
220 220
         // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename));
@@ -222,10 +222,10 @@  discard block
 block discarded – undo
222 222
     }
223 223
 } elseif ($modulepart == "mycompany" && preg_match('/^\/?logos\//', $original_file)) {
224 224
     // Get logos
225
-    readfile(dol_osencode($conf->mycompany->dir_output . "/" . $original_file));
225
+    readfile(dol_osencode($conf->mycompany->dir_output."/".$original_file));
226 226
 } else {
227 227
     // Find the subdirectory name as the reference
228
-    include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
228
+    include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
229 229
     $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, null, $refname);
230 230
     $accessallowed              = empty($check_access['accessallowed']) ? '' : $check_access['accessallowed'];
231 231
     $sqlprotectagainstexternals = empty($check_access['sqlprotectagainstexternals']) ? '' : $check_access['sqlprotectagainstexternals'];
@@ -252,24 +252,24 @@  discard block
 block discarded – undo
252 252
 
253 253
     // This test if file exists should be useless. We keep it to find bug more easily
254 254
     if (!file_exists($fullpath_original_file_osencoded)) {
255
-        print "ErrorFileDoesNotExists: " . dol_escape_htmltag($original_file);
255
+        print "ErrorFileDoesNotExists: ".dol_escape_htmltag($original_file);
256 256
         exit;
257 257
     }
258 258
 
259 259
     // Permissions are ok and file found, so we return it
260 260
     //top_httphead($type);
261
-    header('Content-Type: ' . $type);
261
+    header('Content-Type: '.$type);
262 262
     header('Content-Description: File Transfer');
263 263
     if ($encoding) {
264
-        header('Content-Encoding: ' . $encoding);
264
+        header('Content-Encoding: '.$encoding);
265 265
     }
266 266
     // Add MIME Content-Disposition from RFC 2183 (inline=automatically displayed, attachment=need user action to open)
267 267
     if ($attachment) {
268
-        header('Content-Disposition: attachment; filename="' . $filename . '"');
268
+        header('Content-Disposition: attachment; filename="'.$filename.'"');
269 269
     } else {
270
-        header('Content-Disposition: inline; filename="' . $filename . '"');
270
+        header('Content-Disposition: inline; filename="'.$filename.'"');
271 271
     }
272
-    header('Content-Length: ' . dol_filesize($fullpath_original_file));
272
+    header('Content-Length: '.dol_filesize($fullpath_original_file));
273 273
 
274 274
     readfile($fullpath_original_file_osencoded);
275 275
 }
Please login to merge, or discard this patch.