@@ -118,10 +118,10 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | |
| 120 | 120 | $parameters = array(); |
| 121 | -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 121 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 122 | 122 | // Delete Link |
| 123 | 123 | $permissiondellink = $user->hasRight('expedition', 'delivery', 'supprimer'); // Used by the include of actions_dellink.inc.php |
| 124 | -include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' |
|
| 124 | +include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' |
|
| 125 | 125 | |
| 126 | 126 | if ($action == 'add' && $permissiontoadd) { |
| 127 | 127 | $array_options = array(); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | $object->date_delivery = dol_now(); |
| 131 | 131 | $object->note_private = GETPOST("note", 'restricthtml'); |
| 132 | - $object->note = $object->note_private; // deprecated |
|
| 132 | + $object->note = $object->note_private; // deprecated |
|
| 133 | 133 | $object->commande_id = GETPOSTINT("commande_id"); |
| 134 | 134 | $object->fk_incoterms = GETPOSTINT('incoterm_id'); |
| 135 | 135 | // $object->entrepot_id = GETPOST('entrepot_id', 'int'); entrepot_id does not exists on delivery note, only on shipment document |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | // Update extrafields |
| 220 | 220 | if ($action == 'update_extras' && $permissiontoeditextra) { |
| 221 | - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 221 | + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 222 | 222 | |
| 223 | 223 | $attribute_name = GETPOST('attribute', 'aZ09'); |
| 224 | 224 | |
@@ -285,8 +285,8 @@ discard block |
||
| 285 | 285 | $paramname = 'id'; |
| 286 | 286 | $autocopy = 'MAIN_MAIL_AUTOCOPY_DELIVERY_TO'; |
| 287 | 287 | $mode = 'emailfromdelivery'; |
| 288 | -$trackid = 'del' . $object->id; |
|
| 289 | -include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php'; |
|
| 288 | +$trackid = 'del'.$object->id; |
|
| 289 | +include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; |
|
| 290 | 290 | |
| 291 | 291 | |
| 292 | 292 | /* |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | $morehtmlref = '<div class="refidno">'; |
| 367 | 367 | // Ref customer shipment |
| 368 | 368 | $morehtmlref .= $form->editfieldkey("RefCustomer", '', $expedition->ref_customer, $expedition, $user->hasRight('expedition', 'creer'), 'string', '', 0, 1); |
| 369 | - $morehtmlref .= $form->editfieldval("RefCustomer", '', $expedition->ref_customer, $expedition, $user->hasRight('expedition', 'creer'), 'string'.(getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); |
|
| 369 | + $morehtmlref .= $form->editfieldval("RefCustomer", '', $expedition->ref_customer, $expedition, $user->hasRight('expedition', 'creer'), 'string'.(getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') ? ':'.getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); |
|
| 370 | 370 | $morehtmlref .= '<br>'.$langs->trans("RefDeliveryReceipt").' : '.$object->ref; |
| 371 | 371 | // Thirdparty |
| 372 | 372 | $morehtmlref .= '<br>'.$expedition->thirdparty->getNomUrl(1); |
@@ -758,8 +758,8 @@ discard block |
||
| 758 | 758 | // Presend form |
| 759 | 759 | $modelmail = 'delivery_send'; |
| 760 | 760 | $defaulttopic = 'SendDeliveryRef'; |
| 761 | - $diroutput = $conf->expedition->dir_output . '/receipt'; |
|
| 762 | - $trackid = 'del' . $object->id; |
|
| 761 | + $diroutput = $conf->expedition->dir_output.'/receipt'; |
|
| 762 | + $trackid = 'del'.$object->id; |
|
| 763 | 763 | |
| 764 | 764 | include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; |
| 765 | 765 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | throw new RestException(500, 'Error generating document'); |
| 219 | 219 | } |
| 220 | 220 | } elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') { |
| 221 | - require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; |
|
| 221 | + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; |
|
| 222 | 222 | $tmpobject = new FactureFournisseur($this->db); |
| 223 | 223 | $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
| 224 | 224 | if (!$result) { |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | throw new RestException(500, 'Error generating document'); |
| 256 | 256 | } |
| 257 | 257 | } elseif ($modulepart == 'contrat' || $modulepart == 'contract') { |
| 258 | - require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
| 258 | + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 259 | 259 | |
| 260 | 260 | $tmpobject = new Contrat($this->db); |
| 261 | 261 | $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | throw new RestException(500, 'Error generating document missing doctemplate parameter'); |
| 272 | 272 | } |
| 273 | 273 | } elseif ($modulepart == 'expedition' || $modulepart == 'shipment') { |
| 274 | - require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; |
|
| 274 | + require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; |
|
| 275 | 275 | |
| 276 | 276 | $tmpobject = new Expedition($this->db); |
| 277 | 277 | $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | throw new RestException(500, 'Error generating document missing doctemplate parameter'); |
| 288 | 288 | } |
| 289 | 289 | } elseif ($modulepart == 'mrp') { |
| 290 | - require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php'; |
|
| 290 | + require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; |
|
| 291 | 291 | |
| 292 | 292 | $tmpobject = new Mo($this->db); |
| 293 | 293 | $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | throw new RestException(404, 'Exepnse report not found'); |
| 313 | 313 | } |
| 314 | 314 | } elseif ($modulepart == 'product') { |
| 315 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
| 315 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
| 316 | 316 | |
| 317 | 317 | $tmpobject = new Product($this->db); |
| 318 | 318 | $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | throw new RestException(404, 'User not found'); |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - $upload_dir = getMultidirOutput($object) . '/'.get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id; |
|
| 419 | + $upload_dir = getMultidirOutput($object).'/'.get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id; |
|
| 420 | 420 | } elseif ($modulepart == 'adherent' || $modulepart == 'member') { |
| 421 | 421 | require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
| 422 | 422 | |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | throw new RestException(404, 'Member not found'); |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - $upload_dir = getMultidirOutput($object) . "/".get_exdir(0, 0, 0, 1, $object, 'member'); |
|
| 433 | + $upload_dir = getMultidirOutput($object)."/".get_exdir(0, 0, 0, 1, $object, 'member'); |
|
| 434 | 434 | } elseif ($modulepart == 'propal' || $modulepart == 'proposal') { |
| 435 | 435 | require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
| 436 | 436 | |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | throw new RestException(404, 'Order not found'); |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - $upload_dir = getMultidirOutput($object). "/".get_exdir(0, 0, 0, 1, $object, 'commande'); |
|
| 475 | + $upload_dir = getMultidirOutput($object)."/".get_exdir(0, 0, 0, 1, $object, 'commande'); |
|
| 476 | 476 | } elseif ($modulepart == 'commande_fournisseur' || $modulepart == 'supplier_order') { |
| 477 | 477 | $modulepart = 'supplier_order'; |
| 478 | 478 | |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | throw new RestException(404, 'Purchase order not found'); |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | - $upload_dir = getMultidirOutput($object) . "/commande/".dol_sanitizeFileName($object->ref); |
|
| 491 | + $upload_dir = getMultidirOutput($object)."/commande/".dol_sanitizeFileName($object->ref); |
|
| 492 | 492 | } elseif ($modulepart == 'shipment' || $modulepart == 'expedition') { |
| 493 | 493 | require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; |
| 494 | 494 | |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | throw new RestException(404, 'Shipment not found'); |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - $upload_dir = getMultidirOutput($object) . "/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment'); |
|
| 505 | + $upload_dir = getMultidirOutput($object)."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment'); |
|
| 506 | 506 | } elseif ($modulepart == 'facture' || $modulepart == 'invoice') { |
| 507 | 507 | require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
| 508 | 508 | |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | throw new RestException(404, 'Invoice not found'); |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | - $upload_dir = getMultidirOutput($object) . "/".get_exdir(0, 0, 0, 1, $object, 'invoice'); |
|
| 519 | + $upload_dir = getMultidirOutput($object)."/".get_exdir(0, 0, 0, 1, $object, 'invoice'); |
|
| 520 | 520 | } elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice') { |
| 521 | 521 | $modulepart = 'supplier_invoice'; |
| 522 | 522 | |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | throw new RestException(404, 'Invoice not found'); |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | - $upload_dir = getMultidirOutput($object) . "/".get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').dol_sanitizeFileName($object->ref); |
|
| 535 | + $upload_dir = getMultidirOutput($object)."/".get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').dol_sanitizeFileName($object->ref); |
|
| 536 | 536 | } elseif ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'service') { |
| 537 | 537 | require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
| 538 | 538 | |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | throw new RestException(404, 'Event not found'); |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | - $upload_dir = getMultidirOutput($object) . '/'.dol_sanitizeFileName($object->ref); |
|
| 565 | + $upload_dir = getMultidirOutput($object).'/'.dol_sanitizeFileName($object->ref); |
|
| 566 | 566 | } elseif ($modulepart == 'expensereport') { |
| 567 | 567 | require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; |
| 568 | 568 | |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | throw new RestException(404, 'Expense report not found'); |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | - $upload_dir = getMultidirOutput($object) . '/'.dol_sanitizeFileName($object->ref); |
|
| 579 | + $upload_dir = getMultidirOutput($object).'/'.dol_sanitizeFileName($object->ref); |
|
| 580 | 580 | } elseif ($modulepart == 'ticket') { |
| 581 | 581 | require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
| 582 | 582 | |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | throw new RestException(404, 'KM article not found'); |
| 605 | 605 | } |
| 606 | 606 | |
| 607 | - $upload_dir = getMultidirOutput($object) . '/knowledgerecord/'.dol_sanitizeFileName($object->ref); |
|
| 607 | + $upload_dir = getMultidirOutput($object).'/knowledgerecord/'.dol_sanitizeFileName($object->ref); |
|
| 608 | 608 | } elseif ($modulepart == 'categorie' || $modulepart == 'category') { |
| 609 | 609 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
| 610 | 610 | |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | // $recursive = 0; |
| 638 | 638 | } elseif ($modulepart == 'contrat' || $modulepart == 'contract') { |
| 639 | 639 | $modulepart = 'contrat'; |
| 640 | - require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
| 640 | + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 641 | 641 | |
| 642 | 642 | $object = new Contrat($this->db); |
| 643 | 643 | $result = $object->fetch($id, $ref); |
@@ -645,10 +645,10 @@ discard block |
||
| 645 | 645 | throw new RestException(404, 'Contract not found'); |
| 646 | 646 | } |
| 647 | 647 | |
| 648 | - $upload_dir = getMultidirOutput($object) . "/" . get_exdir(0, 0, 0, 1, $object, 'contract'); |
|
| 648 | + $upload_dir = getMultidirOutput($object)."/".get_exdir(0, 0, 0, 1, $object, 'contract'); |
|
| 649 | 649 | } elseif ($modulepart == 'intervention' || $modulepart == 'ficheinter') { |
| 650 | 650 | $modulepart = 'ficheinter'; |
| 651 | - require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php'; |
|
| 651 | + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
|
| 652 | 652 | |
| 653 | 653 | $object = new Fichinter($this->db); |
| 654 | 654 | $result = $object->fetch($id, $ref); |
@@ -656,20 +656,20 @@ discard block |
||
| 656 | 656 | throw new RestException(404, 'Interventional not found'); |
| 657 | 657 | } |
| 658 | 658 | |
| 659 | - $upload_dir = $conf->ficheinter->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'ficheinter'); |
|
| 659 | + $upload_dir = $conf->ficheinter->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'ficheinter'); |
|
| 660 | 660 | } elseif ($modulepart == 'projet' || $modulepart == 'project') { |
| 661 | 661 | $modulepart = 'project'; |
| 662 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 662 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 663 | 663 | |
| 664 | 664 | $object = new Project($this->db); |
| 665 | 665 | $result = $object->fetch($id, $ref); |
| 666 | 666 | if (!$result) { |
| 667 | 667 | throw new RestException(404, 'Project not found'); |
| 668 | 668 | } |
| 669 | - $upload_dir = $conf->project->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'project'); |
|
| 669 | + $upload_dir = $conf->project->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'project'); |
|
| 670 | 670 | } elseif ($modulepart == 'task' || $modulepart == 'project_task') { |
| 671 | 671 | $modulepart = 'project_task'; |
| 672 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php'; |
|
| 672 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; |
|
| 673 | 673 | |
| 674 | 674 | if (!DolibarrApiAccess::$user->hasRight('projet', 'lire')) { |
| 675 | 675 | throw new RestException(403); |
@@ -687,10 +687,10 @@ discard block |
||
| 687 | 687 | throw new RestException(500, 'Error while fetching project for task'); |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | - $upload_dir = $conf->project->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . "/" . dol_sanitizeFileName($object->ref); |
|
| 690 | + $upload_dir = $conf->project->dir_output."/".dol_sanitizeFileName($object->project->ref)."/".dol_sanitizeFileName($object->ref); |
|
| 691 | 691 | } elseif ($modulepart == 'mrp') { |
| 692 | 692 | $modulepart = 'mrp'; |
| 693 | - require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php'; |
|
| 693 | + require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; |
|
| 694 | 694 | |
| 695 | 695 | $object = new Mo($this->db); |
| 696 | 696 | $result = $object->fetch($id, $ref); |
@@ -698,23 +698,23 @@ discard block |
||
| 698 | 698 | throw new RestException(404, 'MO not found'); |
| 699 | 699 | } |
| 700 | 700 | |
| 701 | - $upload_dir = getMultidirOutput($object) . "/" . get_exdir(0, 0, 0, 1, $object, 'mrp'); |
|
| 701 | + $upload_dir = getMultidirOutput($object)."/".get_exdir(0, 0, 0, 1, $object, 'mrp'); |
|
| 702 | 702 | } elseif ($modulepart == 'contact' || $modulepart == 'socpeople') { |
| 703 | 703 | $modulepart = 'contact'; |
| 704 | 704 | require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
| 705 | 705 | |
| 706 | 706 | $object = new Contact($this->db); |
| 707 | - $result = $object->fetch($id?$id:$ref); |
|
| 707 | + $result = $object->fetch($id ? $id : $ref); |
|
| 708 | 708 | if (!$result) { |
| 709 | 709 | throw new RestException(404, 'Contact not found'); |
| 710 | 710 | } |
| 711 | - $upload_dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity] . "/contact/" . get_exdir(0, 0, 0, 1, $object, 'contact'); |
|
| 711 | + $upload_dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity]."/contact/".get_exdir(0, 0, 0, 1, $object, 'contact'); |
|
| 712 | 712 | } else { |
| 713 | 713 | throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | $objectType = $modulepart; |
| 717 | - if (! empty($object->id) && ! empty($object->table_element)) { |
|
| 717 | + if (!empty($object->id) && !empty($object->table_element)) { |
|
| 718 | 718 | $objectType = $object->table_element; |
| 719 | 719 | } |
| 720 | 720 | |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | throw new RestException(503, 'Error when retrieve ecm list : '.$this->db->lasterror()); |
| 733 | 733 | } elseif (is_array($ecmfile->lines) && count($ecmfile->lines) > 0) { |
| 734 | 734 | $count = count($filearray); |
| 735 | - for ($i = 0 ; $i < $count ; $i++) { |
|
| 735 | + for ($i = 0; $i < $count; $i++) { |
|
| 736 | 736 | foreach ($ecmfile->lines as $line) { |
| 737 | 737 | unset($line->db); |
| 738 | 738 | if ($filearray[$i]['name'] == $line->filename) { |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | $object = new Propal($this->db); |
| 913 | 913 | } elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') { |
| 914 | 914 | $modulepart = 'agenda'; |
| 915 | - require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; |
|
| 915 | + require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
|
| 916 | 916 | $object = new ActionComm($this->db); |
| 917 | 917 | } elseif ($modulepart == 'contact' || $modulepart == 'socpeople') { |
| 918 | 918 | $modulepart = 'contact'; |
@@ -924,23 +924,23 @@ discard block |
||
| 924 | 924 | require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
| 925 | 925 | $object = new Societe($this->db); |
| 926 | 926 | $fetchbyid = true; |
| 927 | - } elseif ($modulepart == 'knowledgemanagement' ) { |
|
| 927 | + } elseif ($modulepart == 'knowledgemanagement') { |
|
| 928 | 928 | $modulepart = 'knowledgemanagement'; |
| 929 | 929 | require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; |
| 930 | 930 | $object = new KnowledgeRecord($this->db); |
| 931 | 931 | $fetchbyid = true; |
| 932 | - } elseif ($modulepart == 'ticket' ) { |
|
| 932 | + } elseif ($modulepart == 'ticket') { |
|
| 933 | 933 | $modulepart = 'ticket'; |
| 934 | 934 | require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; |
| 935 | 935 | $object = new Ticket($this->db); |
| 936 | 936 | $fetchbyid = true; |
| 937 | 937 | } elseif ($modulepart == 'contrat' || $modulepart == 'contract') { |
| 938 | 938 | $modulepart = 'contrat'; |
| 939 | - require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
| 939 | + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 940 | 940 | $object = new Contrat($this->db); |
| 941 | 941 | } elseif ($modulepart == 'mrp') { |
| 942 | 942 | $modulepart = 'mrp'; |
| 943 | - require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php'; |
|
| 943 | + require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; |
|
| 944 | 944 | $object = new Mo($this->db); |
| 945 | 945 | } elseif ($modulepart == 'ecm') { |
| 946 | 946 | throw new RestException(500, 'Using a non empty "ref" is not compatible with using modulepart = '.$modulepart); |
@@ -149,9 +149,9 @@ discard block |
||
| 149 | 149 | $this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace'; |
| 150 | 150 | |
| 151 | 151 | // For dolistore modules |
| 152 | - $this->dolistore_api_url = getDolGlobalString('MAIN_MODULE_DOLISTORE_API_SRV', 'https://www.dolistore.com/api/'); // 'https://www.dolistore.com/api/', 'https://admin2.dolibarr.org/api/index.php/marketplace/' |
|
| 152 | + $this->dolistore_api_url = getDolGlobalString('MAIN_MODULE_DOLISTORE_API_SRV', 'https://www.dolistore.com/api/'); // 'https://www.dolistore.com/api/', 'https://admin2.dolibarr.org/api/index.php/marketplace/' |
|
| 153 | 153 | $this->dolistore_api_key = getDolGlobalString('MAIN_MODULE_DOLISTORE_API_KEY', 'dolistorepublicapi'); |
| 154 | - $this->shop_url = getDolGlobalString('MAIN_MODULE_DOLISTORE_SHOP_URL', 'https://www.dolistore.com'); |
|
| 154 | + $this->shop_url = getDolGlobalString('MAIN_MODULE_DOLISTORE_SHOP_URL', 'https://www.dolistore.com'); |
|
| 155 | 155 | |
| 156 | 156 | // For community modules |
| 157 | 157 | $this->file_source_url = "https://raw.githubusercontent.com/Dolibarr/dolibarr-community-modules/refs/heads/main/index.yaml"; |
@@ -215,12 +215,12 @@ discard block |
||
| 215 | 215 | $httpheader[] = 'Authorization: Basic '.base64_encode($basicAuthLogin.':'.$basicAuthPassword); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - $url = $this->dolistore_api_url . (preg_match('/\/$/', $this->dolistore_api_url) ? '' : '/') . $resource; |
|
| 218 | + $url = $this->dolistore_api_url.(preg_match('/\/$/', $this->dolistore_api_url) ? '' : '/').$resource; |
|
| 219 | 219 | |
| 220 | 220 | $options['apikey'] = $this->dolistore_api_key; |
| 221 | 221 | |
| 222 | 222 | if ($options) { |
| 223 | - $url .= '?' . http_build_query($options); |
|
| 223 | + $url .= '?'.http_build_query($options); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | $response = getURLContent($url, 'GET', '', 1, $httpheader, array('https'), 0, -1, 5, 5); |
@@ -262,13 +262,13 @@ discard block |
||
| 262 | 262 | $modules = array(); |
| 263 | 263 | |
| 264 | 264 | if (!empty($this->cache_file) && file_exists($this->cache_file)) { |
| 265 | - dol_syslog(__METHOD__ . " - Loading cache file: " . $this->cache_file, LOG_DEBUG); |
|
| 265 | + dol_syslog(__METHOD__." - Loading cache file: ".$this->cache_file, LOG_DEBUG); |
|
| 266 | 266 | |
| 267 | 267 | $content = file_get_contents($this->cache_file); |
| 268 | 268 | if ($content !== false) { |
| 269 | 269 | $modules = $this->readYaml($content); |
| 270 | 270 | } else { |
| 271 | - dol_syslog(__METHOD__ . " - Error reading cache file", LOG_ERR); |
|
| 271 | + dol_syslog(__METHOD__." - Error reading cache file", LOG_ERR); |
|
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
@@ -296,20 +296,20 @@ discard block |
||
| 296 | 296 | if (isset($resCategories['response']) && is_array($resCategories['response'])) { |
| 297 | 297 | $organized_tree = $resCategories['response']; |
| 298 | 298 | } else { |
| 299 | - return $html ; |
|
| 299 | + return $html; |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | $html = ''; |
| 303 | 303 | foreach ($organized_tree as $key => $value) { |
| 304 | 304 | if ($value['label'] != "Versions" && $value['label'] != "Specials") { |
| 305 | - $html .= '<li' . ($current == $value['rowid'] ? ' class="active"' : '') . '>'; |
|
| 306 | - $html .= '<a href="?mode=marketplace&categorie=' . $value['rowid'] . '">' . $value['label'] . '</a>'; |
|
| 305 | + $html .= '<li'.($current == $value['rowid'] ? ' class="active"' : '').'>'; |
|
| 306 | + $html .= '<a href="?mode=marketplace&categorie='.$value['rowid'].'">'.$value['label'].'</a>'; |
|
| 307 | 307 | if (isset($value['children'])) { |
| 308 | 308 | $html .= '<ul>'; |
| 309 | 309 | usort($value['children'], $this->buildSorter('position')); |
| 310 | 310 | foreach ($value['children'] as $key_children => $value_children) { |
| 311 | - $html .= '<li' . ($current == $value_children['rowid'] ? ' class="active"' : '') . '>'; |
|
| 312 | - $html .= '<a href="?mode=marketplace&categorie=' . $value_children['rowid'] . '" title="' . dol_escape_htmltag(strip_tags($value_children['description'])) . '">' . $value_children['label'] . '</a>'; |
|
| 311 | + $html .= '<li'.($current == $value_children['rowid'] ? ' class="active"' : '').'>'; |
|
| 312 | + $html .= '<a href="?mode=marketplace&categorie='.$value_children['rowid'].'" title="'.dol_escape_htmltag(strip_tags($value_children['description'])).'">'.$value_children['label'].'</a>'; |
|
| 313 | 313 | $html .= '</li>'; |
| 314 | 314 | } |
| 315 | 315 | $html .= '</ul>'; |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | $html = ""; |
| 336 | 336 | $last_month = dol_now() - (30 * 24 * 60 * 60); |
| 337 | - $dolibarrversiontouse = DOL_VERSION; // full string with version |
|
| 337 | + $dolibarrversiontouse = DOL_VERSION; // full string with version |
|
| 338 | 338 | |
| 339 | 339 | $this->products = array(); |
| 340 | 340 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | $this->no_page = $options['no_page'] ?? 1; |
| 344 | 344 | $this->search = $options['search'] ?? ''; |
| 345 | 345 | |
| 346 | - $this->per_page = 11; // We fix number of products per page to 11 |
|
| 346 | + $this->per_page = 11; // We fix number of products per page to 11 |
|
| 347 | 347 | |
| 348 | 348 | // Length of $search must be at least 2 characters |
| 349 | 349 | if (!empty($this->search) && strlen(str_replace(' ', '', (string) $this->search)) < 2) { |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | $fileProducts = array(); |
| 405 | 405 | $fileProductsTotal = 0; |
| 406 | 406 | if (!empty($this->githubFileStatus) && getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_COMMUNITY')) { |
| 407 | - $fileProducts = $this->fetchModulesFromFile($data); // Return an array with all modules from the cache filecontent in $data |
|
| 407 | + $fileProducts = $this->fetchModulesFromFile($data); // Return an array with all modules from the cache filecontent in $data |
|
| 408 | 408 | |
| 409 | 409 | $fileProducts = $this->adaptData($fileProducts, 'githubcommunity'); |
| 410 | 410 | |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | $download_link .= img_picto('', 'file-code', 'class="size2x paddingright colorgrey"'); |
| 496 | 496 | $download_link .= '</a>'; |
| 497 | 497 | |
| 498 | - $urlview = $product["dolistore-download"]; // In a future, we will have the download to the zip file |
|
| 498 | + $urlview = $product["dolistore-download"]; // In a future, we will have the download to the zip file |
|
| 499 | 499 | if ($urlview) { |
| 500 | 500 | $download_link .= '<a class="paddingleft paddingright" target="_blank" title="'.$langs->trans("View").'" href="'.$urlview.'" rel="noopener noreferrer">'; |
| 501 | 501 | $download_link .= img_picto('', 'url', 'class="size2x"'); |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | } |
| 515 | 515 | } elseif ($product['source'] === 'dolistore') { |
| 516 | 516 | $urlview = $this->shop_url.'/product.php?id='.((int) $product["id"]); |
| 517 | - $urldownload = 'https://www.dolistore.com/_service_download.php?t=free&p=' . $product['id']; |
|
| 517 | + $urldownload = 'https://www.dolistore.com/_service_download.php?t=free&p='.$product['id']; |
|
| 518 | 518 | $download_link = '<a class="paddingleft paddingright" target="_blank" title="'.$langs->trans("View").'" href="'.$urlview.'">'; |
| 519 | 519 | $download_link .= img_picto('', 'url', 'class="size2x"'); |
| 520 | 520 | $download_link .= '</a>'; |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | |
| 579 | 579 | // Logo |
| 580 | 580 | $html .= '<td class="center width150"><div class="newAppParent">'; |
| 581 | - $html .= $newapp.$images; // No dol_escape_htmltag, it is already escape html |
|
| 581 | + $html .= $newapp.$images; // No dol_escape_htmltag, it is already escape html |
|
| 582 | 582 | $html .= '</div></td>'; |
| 583 | 583 | |
| 584 | 584 | // Description |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | $html .= '</small>'; |
| 595 | 595 | } |
| 596 | 596 | $html .= '<br><small>'; |
| 597 | - $html .= $version; // Version Dolibarr. No dol_escape_htmltag, it is already escape html |
|
| 597 | + $html .= $version; // Version Dolibarr. No dol_escape_htmltag, it is already escape html |
|
| 598 | 598 | $html .= '</small>'; |
| 599 | 599 | $html .= '</h2>'; |
| 600 | 600 | |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | * @param array<string, mixed> $b |
| 672 | 672 | * @return int |
| 673 | 673 | */ |
| 674 | - function (array $a, array $b) use ($key) { |
|
| 674 | + function(array $a, array $b) use ($key) { |
|
| 675 | 675 | $valA = isset($a[$key]) && is_scalar($a[$key]) ? (string) $a[$key] : ''; |
| 676 | 676 | $valB = isset($b[$key]) && is_scalar($b[$key]) ? (string) $b[$key] : ''; |
| 677 | 677 | |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | $pagelist .= '<li class="pagination">'; |
| 833 | 833 | $pagelist .= '<label for="page_input">Page </label>'; |
| 834 | 834 | if ($this->categorie != 0) { |
| 835 | - $pagelist .= '<input type="hidden" name="categorie" value="' . $this->categorie . '">'; |
|
| 835 | + $pagelist .= '<input type="hidden" name="categorie" value="'.$this->categorie.'">'; |
|
| 836 | 836 | } |
| 837 | 837 | $pagelist .= '<input type="text" id="page_input" name="no_page" value="'.($page).'" min="1" max="'.$nbpages.'" class="width40 page_input right" oninput="if(this.value > '.$nbpages.') this.value='.$nbpages.'">'; |
| 838 | 838 | $pagelist .= ' / '.$nbpages; |
@@ -882,17 +882,17 @@ discard block |
||
| 882 | 882 | } |
| 883 | 883 | |
| 884 | 884 | // Get the predefined error message or use a default one |
| 885 | - $error_message = $error_messages[$request['status_code']] ?? 'Unexpected HTTP status: ' . $request['status_code']; |
|
| 885 | + $error_message = $error_messages[$request['status_code']] ?? 'Unexpected HTTP status: '.$request['status_code']; |
|
| 886 | 886 | |
| 887 | 887 | // Append error details if available |
| 888 | 888 | if (!empty($request['response']) && isset($request['response']['errors']) && is_array($request['response']['errors'])) { |
| 889 | 889 | foreach ($request['response']['errors'] as $error) { |
| 890 | - $error_message .= ' - (Code ' . $error['code'] . '): ' . $error['message']; |
|
| 890 | + $error_message .= ' - (Code '.$error['code'].'): '.$error['message']; |
|
| 891 | 891 | } |
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | if (!empty($request['curl_error_msg'])) { |
| 895 | - $error_message .= ' - ' . $request['curl_error_msg']; |
|
| 895 | + $error_message .= ' - '.$request['curl_error_msg']; |
|
| 896 | 896 | } |
| 897 | 897 | |
| 898 | 898 | // Return the formatted error message |
@@ -920,12 +920,12 @@ discard block |
||
| 920 | 920 | if (!file_exists($cache_file) || filemtime($cache_file) < (dol_now() - $cache_time)) { |
| 921 | 921 | // We get remote url |
| 922 | 922 | $addheaders = array(); |
| 923 | - $result = getURLContent($file_source_url, 'GET', '', 1, $addheaders); // TODO Force timeout to 5 s on both connect and response. |
|
| 923 | + $result = getURLContent($file_source_url, 'GET', '', 1, $addheaders); // TODO Force timeout to 5 s on both connect and response. |
|
| 924 | 924 | if (!empty($result) && $result['http_code'] == 200) { |
| 925 | 925 | $yaml = $result['content']; |
| 926 | 926 | $result = file_put_contents($cache_file, $yaml); |
| 927 | 927 | if ($result === false) { |
| 928 | - $this->error = 'Failed to create cache file: ' . $cache_file; |
|
| 928 | + $this->error = 'Failed to create cache file: '.$cache_file; |
|
| 929 | 929 | } else { |
| 930 | 930 | dolChmod($cache_file); |
| 931 | 931 | } |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | |
| 1040 | 1040 | $adaptedPackage = [ |
| 1041 | 1041 | 'id' => $id, |
| 1042 | - 'ref' => str_replace(' ', '', $package['modulename'] . '-' . $package['current_version'] . '@' . |
|
| 1042 | + 'ref' => str_replace(' ', '', $package['modulename'].'-'.$package['current_version'].'@'. |
|
| 1043 | 1043 | (array_key_exists('author', $package) ? $package['author'] : 'unkownauthor')), |
| 1044 | 1044 | 'label' => !empty($package['label'][substr($this->lang, 0, 2)]) |
| 1045 | 1045 | ? $package['label'][substr($this->lang, 0, 2)] |
@@ -1155,7 +1155,7 @@ discard block |
||
| 1155 | 1155 | * |
| 1156 | 1156 | * @return int |
| 1157 | 1157 | */ |
| 1158 | - static function ($a, $b) { |
|
| 1158 | + static function($a, $b) { |
|
| 1159 | 1159 | return strtotime($b['datec'] ?? '0') - strtotime($a['datec'] ?? '0'); |
| 1160 | 1160 | } |
| 1161 | 1161 | ); |
@@ -1170,7 +1170,7 @@ discard block |
||
| 1170 | 1170 | * |
| 1171 | 1171 | * @return bool |
| 1172 | 1172 | */ |
| 1173 | - static function ($package) use ($options) { |
|
| 1173 | + static function($package) use ($options) { |
|
| 1174 | 1174 | return stripos($package['label'], $options['search']) !== false || stripos($package['description'], $options['search']) !== false; |
| 1175 | 1175 | } |
| 1176 | 1176 | ); |
@@ -1186,7 +1186,7 @@ discard block |
||
| 1186 | 1186 | * |
| 1187 | 1187 | * @return bool |
| 1188 | 1188 | */ |
| 1189 | - static function ($package) use ($options) { |
|
| 1189 | + static function($package) use ($options) { |
|
| 1190 | 1190 | return in_array($options['categorieid'], $package['category']); |
| 1191 | 1191 | } |
| 1192 | 1192 | ); |
@@ -88,9 +88,9 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | // MAIN_ENABLE_EXTERNALMODULES_DOLISTORE is 1 if we enabled the dolistore modules |
| 91 | -$options['search_source_dolistore'] = getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_DOLISTORE'); |
|
| 91 | +$options['search_source_dolistore'] = getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_DOLISTORE'); |
|
| 92 | 92 | // MAIN_ENABLE_EXTERNALMODULES_COMMUNITY is 1 if we enabled the community modules |
| 93 | -$options['search_source_github'] = getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_COMMUNITY'); |
|
| 93 | +$options['search_source_github'] = getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_COMMUNITY'); |
|
| 94 | 94 | |
| 95 | 95 | if (!$user->admin) { |
| 96 | 96 | accessforbidden(); |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | //var_dump($modulenamearrays);exit; |
| 341 | 341 | |
| 342 | 342 | // Lop on each packages (can have several if package is a metapackage) |
| 343 | - if (! $error) { |
|
| 343 | + if (!$error) { |
|
| 344 | 344 | foreach ($modulenamearrays as $modulenameval) { |
| 345 | 345 | if (strpos($modulenameval, '#') === 0) { |
| 346 | 346 | continue; // Discard comments |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | 'search_version' => '-1' |
| 400 | 400 | ); |
| 401 | 401 | $queryString = http_build_query($searchParams); |
| 402 | - $redirectUrl = DOL_URL_ROOT . '/admin/modules.php?' . $queryString; |
|
| 402 | + $redirectUrl = DOL_URL_ROOT.'/admin/modules.php?'.$queryString; |
|
| 403 | 403 | |
| 404 | 404 | $message = $langs->trans("SetupIsReadyForUse", $redirectUrl, $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")); |
| 405 | 405 | |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : '')); |
| 453 | 453 | exit; |
| 454 | 454 | } elseif (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1 && $action == 'reload' && $user->admin && GETPOST('confirm') == 'yes') { |
| 455 | - $result = unActivateModule($value, 0, 'newboxdefonly'); // unactivate all module features but for widget, we reload only definition and we do not change position or setup |
|
| 455 | + $result = unActivateModule($value, 0, 'newboxdefonly'); // unactivate all module features but for widget, we reload only definition and we do not change position or setup |
|
| 456 | 456 | dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity); |
| 457 | 457 | if ($result) { |
| 458 | 458 | setEventMessages($result, null, 'errors'); |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | } else { |
| 603 | 603 | $familykey = $objMod->family; |
| 604 | 604 | } |
| 605 | - '@phan-var-force string $familykey'; // if not, phan considers $familykey may be null |
|
| 605 | + '@phan-var-force string $familykey'; // if not, phan considers $familykey may be null |
|
| 606 | 606 | |
| 607 | 607 | $moduleposition = ($objMod->module_position ? $objMod->module_position : '50'); |
| 608 | 608 | if ($objMod->isCoreOrExternalModule() == 'external' && $moduleposition < 100000) { |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | print load_fiche_titre($langs->trans("ModulesSetup"), '', 'title_setup'); |
| 709 | 709 | |
| 710 | 710 | // Start to show page |
| 711 | -$deschelp = ''; |
|
| 711 | +$deschelp = ''; |
|
| 712 | 712 | if ($mode == 'common' || $mode == 'commonkanban') { |
| 713 | 713 | $desc = $langs->trans("ModulesDesc", '{picto}'); |
| 714 | 714 | $desc .= ' '.$langs->trans("ModulesDesc2", '{picto2}'); |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | } |
| 993 | 993 | |
| 994 | 994 | if ($objMod->isCoreOrExternalModule() == 'external' && $action == 'checklastversion' && !getDolGlobalString('DISABLE_CHECK_ON_MALWARE_MODULES')) { |
| 995 | - $checkRes = $objMod->checkForCompliance(); // Check if module is reported as non compliant with Dolibarr rules and law |
|
| 995 | + $checkRes = $objMod->checkForCompliance(); // Check if module is reported as non compliant with Dolibarr rules and law |
|
| 996 | 996 | if (!is_numeric($checkRes) && $checkRes != '') { |
| 997 | 997 | $langs->load("errors"); |
| 998 | 998 | setEventMessages($objMod->getName().' : '.$langs->trans($checkRes), null, 'errors'); |
@@ -1372,9 +1372,9 @@ discard block |
||
| 1372 | 1372 | |
| 1373 | 1373 | //print '<span class="opacitymedium hideonsmartphone">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>'; |
| 1374 | 1374 | |
| 1375 | - $categories_tree = $remotestore->getCategories($options['categorie']); // Call API to get the categories |
|
| 1375 | + $categories_tree = $remotestore->getCategories($options['categorie']); // Call API to get the categories |
|
| 1376 | 1376 | |
| 1377 | - $products_list = $remotestore->getProducts($options); // Get list of product from all sources |
|
| 1377 | + $products_list = $remotestore->getProducts($options); // Get list of product from all sources |
|
| 1378 | 1378 | |
| 1379 | 1379 | $previouslink = $remotestore->get_previous_link(); |
| 1380 | 1380 | |
@@ -283,22 +283,22 @@ discard block |
||
| 283 | 283 | // Edit .sql file |
| 284 | 284 | if ($moduletype == 'internal') { |
| 285 | 285 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'; |
| 286 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 286 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 287 | 287 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'-'.strtolower($module).'.sql'; |
| 288 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 288 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 289 | 289 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'-'.strtolower($module).'.sql'; |
| 290 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 290 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 291 | 291 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'.sql'; |
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | } else { |
| 296 | 296 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'; |
| 297 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 297 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 298 | 298 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'-'.strtolower($module).'.sql'; |
| 299 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 299 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 300 | 300 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'-'.strtolower($module).'.sql'; |
| 301 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 301 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 302 | 302 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'.sql'; |
| 303 | 303 | } |
| 304 | 304 | } |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | { |
| 742 | 742 | |
| 743 | 743 | // stock all properties in array |
| 744 | - $attributesUnique = array('type','label', 'enabled', 'position', 'notnull', 'visible', 'noteditable', 'index', 'default' , 'foreignkey', 'arrayofkeyval', 'alwayseditable','validate', 'searchall','comment', 'isameasure', 'css', 'cssview','csslist', 'help', 'showoncombobox','picto' ); |
|
| 744 | + $attributesUnique = array('type', 'label', 'enabled', 'position', 'notnull', 'visible', 'noteditable', 'index', 'default', 'foreignkey', 'arrayofkeyval', 'alwayseditable', 'validate', 'searchall', 'comment', 'isameasure', 'css', 'cssview', 'csslist', 'help', 'showoncombobox', 'picto'); |
|
| 745 | 745 | |
| 746 | 746 | $start = "public \$fields = array("; |
| 747 | 747 | $end = ");"; |
@@ -811,8 +811,8 @@ discard block |
||
| 811 | 811 | $valuesModif[$attUnique] = $values[$attUnique]; |
| 812 | 812 | } |
| 813 | 813 | } |
| 814 | - $table .= "|*" . $field[0] . "*|"; |
|
| 815 | - $table .= implode("|", $valuesModif) . "\n"; |
|
| 814 | + $table .= "|*".$field[0]."*|"; |
|
| 815 | + $table .= implode("|", $valuesModif)."\n"; |
|
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | // end table |
@@ -843,14 +843,14 @@ discard block |
||
| 843 | 843 | |
| 844 | 844 | $str = file_get_contents($file); |
| 845 | 845 | |
| 846 | - $search = '/' . preg_quote($start, '/') . '(.*?)' . preg_quote($end, '/') . '/s'; |
|
| 846 | + $search = '/'.preg_quote($start, '/').'(.*?)'.preg_quote($end, '/').'/s'; |
|
| 847 | 847 | $new_contents = preg_replace($search, '', $str); |
| 848 | 848 | file_put_contents($file, $new_contents); |
| 849 | 849 | dolChmod($file); |
| 850 | 850 | |
| 851 | 851 | //perms If Exist |
| 852 | 852 | $perms = "|*".strtolower($objectname)."*|"; |
| 853 | - $search_pattern_perms = '/' . preg_quote($perms, '/') . '.*?\n/'; |
|
| 853 | + $search_pattern_perms = '/'.preg_quote($perms, '/').'.*?\n/'; |
|
| 854 | 854 | $new_contents = preg_replace($search_pattern_perms, '', $new_contents); |
| 855 | 855 | file_put_contents($file, $new_contents); |
| 856 | 856 | dolChmod($file); |
@@ -923,7 +923,7 @@ discard block |
||
| 923 | 923 | $string = "[options='header',grid=rows,width=60%,caption=Organisation]\n"; |
| 924 | 924 | $string .= "|===\n"; |
| 925 | 925 | // header for table |
| 926 | - $header = array($langs->trans('Objects'),$langs->trans('Permission')); |
|
| 926 | + $header = array($langs->trans('Objects'), $langs->trans('Permission')); |
|
| 927 | 927 | foreach ($header as $h) { |
| 928 | 928 | $string .= "|".$h; |
| 929 | 929 | } |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | $now = dol_now(); |
| 1008 | - $content = file($file); // $content is an array |
|
| 1008 | + $content = file($file); // $content is an array |
|
| 1009 | 1009 | |
| 1010 | 1010 | $includeClass = "dol_include_once\(\'\/\w+\/class\/\w+\.class\.php\'\);"; |
| 1011 | 1011 | $props = 'public\s+\$\w+;'; |
@@ -1017,23 +1017,23 @@ discard block |
||
| 1017 | 1017 | if (preg_match('/'.$varcommented.'/', $lineContent)) { |
| 1018 | 1018 | $lineContent = ''; |
| 1019 | 1019 | foreach ($objects as $objectname) { |
| 1020 | - $lineContent .= "\t * @var ".$objectname." \$".strtolower($objectname)." {@type ".$objectname."}". PHP_EOL; |
|
| 1020 | + $lineContent .= "\t * @var ".$objectname." \$".strtolower($objectname)." {@type ".$objectname."}".PHP_EOL; |
|
| 1021 | 1021 | } |
| 1022 | 1022 | //var_dump($lineContent);exit; |
| 1023 | 1023 | } elseif (preg_match('/'.$props.'/', $lineContent)) { |
| 1024 | 1024 | $lineContent = ''; |
| 1025 | 1025 | foreach ($objects as $objectname) { |
| 1026 | - $lineContent .= "\t/*".PHP_EOL."\t * @var mixed TODO: set type".PHP_EOL."\t */".PHP_EOL."\tpublic \$".strtolower($objectname).";". PHP_EOL; |
|
| 1026 | + $lineContent .= "\t/*".PHP_EOL."\t * @var mixed TODO: set type".PHP_EOL."\t */".PHP_EOL."\tpublic \$".strtolower($objectname).";".PHP_EOL; |
|
| 1027 | 1027 | } |
| 1028 | 1028 | } elseif (preg_match('/'.$constructObj.'/', $lineContent)) { |
| 1029 | 1029 | $lineContent = ''; |
| 1030 | 1030 | foreach ($objects as $objectname) { |
| 1031 | - $lineContent .= "\t\t\$this->".strtolower($objectname)." = new ".$objectname."(\$this->db);". PHP_EOL; |
|
| 1031 | + $lineContent .= "\t\t\$this->".strtolower($objectname)." = new ".$objectname."(\$this->db);".PHP_EOL; |
|
| 1032 | 1032 | } |
| 1033 | 1033 | } elseif (preg_match('/'.$includeClass.'/', $lineContent)) { |
| 1034 | 1034 | $lineContent = ''; |
| 1035 | 1035 | foreach ($objects as $objectname) { |
| 1036 | - $lineContent .= "dol_include_once('/".strtolower($modulename)."/class/".strtolower($objectname).".class.php');". PHP_EOL; |
|
| 1036 | + $lineContent .= "dol_include_once('/".strtolower($modulename)."/class/".strtolower($objectname).".class.php');".PHP_EOL; |
|
| 1037 | 1037 | } |
| 1038 | 1038 | } |
| 1039 | 1039 | } |
@@ -1088,7 +1088,7 @@ discard block |
||
| 1088 | 1088 | return -1; |
| 1089 | 1089 | } |
| 1090 | 1090 | |
| 1091 | - $content = file($file); // $content is an array |
|
| 1091 | + $content = file($file); // $content is an array |
|
| 1092 | 1092 | |
| 1093 | 1093 | $includeClass = "dol_include_once\(\'\/\w+\/class\/".strtolower($objectname)."\.class\.php\'\);"; |
| 1094 | 1094 | $props = 'public\s+\$'.strtolower($objectname); |
@@ -1258,33 +1258,33 @@ discard block |
||
| 1258 | 1258 | * @param bool|string|int $val |
| 1259 | 1259 | * @return string|int |
| 1260 | 1260 | */ |
| 1261 | - static function ($val) use ($module) { |
|
| 1261 | + static function($val) use ($module) { |
|
| 1262 | 1262 | return is_bool($val) ? "isModEnabled('$module')" : $val; |
| 1263 | 1263 | }, |
| 1264 | 1264 | $value |
| 1265 | 1265 | ); |
| 1266 | - $dicData .= "array(" . implode(", ", $conditions) . ")"; |
|
| 1266 | + $dicData .= "array(".implode(", ", $conditions).")"; |
|
| 1267 | 1267 | } elseif ($key === 'tabhelp') { |
| 1268 | 1268 | $helpItems = array(); |
| 1269 | 1269 | foreach ($value as $helpValue) { |
| 1270 | 1270 | $helpItems[] = "array('code' => \$langs->trans('".$helpValue['code']."'), 'field2' => 'field2tooltip')"; |
| 1271 | 1271 | } |
| 1272 | - $dicData .= "array(" . implode(",", $helpItems) . ")"; |
|
| 1272 | + $dicData .= "array(".implode(",", $helpItems).")"; |
|
| 1273 | 1273 | } else { |
| 1274 | 1274 | if (is_array($value)) { |
| 1275 | - $dicData .= "array(" . implode( |
|
| 1275 | + $dicData .= "array(".implode( |
|
| 1276 | 1276 | ",", |
| 1277 | 1277 | array_map( |
| 1278 | 1278 | /** |
| 1279 | 1279 | * @param string $val |
| 1280 | 1280 | * @return string |
| 1281 | 1281 | */ |
| 1282 | - static function ($val) { |
|
| 1282 | + static function($val) { |
|
| 1283 | 1283 | return "'$val'"; |
| 1284 | 1284 | }, |
| 1285 | 1285 | $value |
| 1286 | 1286 | ) |
| 1287 | - ) . ")"; |
|
| 1287 | + ).")"; |
|
| 1288 | 1288 | } else { |
| 1289 | 1289 | $dicData .= "'$value'"; |
| 1290 | 1290 | } |
@@ -1373,7 +1373,7 @@ discard block |
||
| 1373 | 1373 | $dictionnaires['tabfieldvalue'][] = (array_key_exists('code', $columns) && array_key_exists('label', $columns) ? 'code,label' : ''); |
| 1374 | 1374 | $dictionnaires['tabfieldinsert'][] = (array_key_exists('code', $columns) && array_key_exists('label', $columns) ? 'code,label' : ''); |
| 1375 | 1375 | $dictionnaires['tabrowid'][] = $primaryKey; |
| 1376 | - $dictionnaires['tabcond'][] = isModEnabled('$modulename'); // @phan-suppress-current-line UnknownModuleName |
|
| 1376 | + $dictionnaires['tabcond'][] = isModEnabled('$modulename'); // @phan-suppress-current-line UnknownModuleName |
|
| 1377 | 1377 | $dictionnaires['tabhelp'][] = (array_key_exists('code', $columns) ? array('code' => $langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip') : ''); |
| 1378 | 1378 | |
| 1379 | 1379 | // Build the dictionary string |
@@ -1427,7 +1427,7 @@ discard block |
||
| 1427 | 1427 | |
| 1428 | 1428 | // build format asciidoc for urls in table |
| 1429 | 1429 | if (!$error) { |
| 1430 | - $asciiDocTable = "[options=\"header\"]\n|===\n|Object | URLs\n"; // phpcs:ignore |
|
| 1430 | + $asciiDocTable = "[options=\"header\"]\n|===\n|Object | URLs\n"; // phpcs:ignore |
|
| 1431 | 1431 | foreach ($groupedUrls as $objectName => $urls) { |
| 1432 | 1432 | $urlsList = implode(" +\n*", $urls); |
| 1433 | 1433 | $asciiDocTable .= "|$objectName | \n*$urlsList +\n"; |
@@ -1460,9 +1460,9 @@ discard block |
||
| 1460 | 1460 | |
| 1461 | 1461 | foreach ($allFilesAndDirs as $item) { |
| 1462 | 1462 | if ($item != '.' && $item != '..') { |
| 1463 | - if ($type == 1 && is_file($path . DIRECTORY_SEPARATOR . $item) && strpos($item, '.back') === false) { |
|
| 1463 | + if ($type == 1 && is_file($path.DIRECTORY_SEPARATOR.$item) && strpos($item, '.back') === false) { |
|
| 1464 | 1464 | $count++; |
| 1465 | - } elseif ($type == 2 && is_dir($path . DIRECTORY_SEPARATOR . $item)) { |
|
| 1465 | + } elseif ($type == 2 && is_dir($path.DIRECTORY_SEPARATOR.$item)) { |
|
| 1466 | 1466 | $count++; |
| 1467 | 1467 | } |
| 1468 | 1468 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | if (dol_is_file($filetpl)) { |
| 155 | 155 | if ($backupold) { |
| 156 | 156 | $result = archiveOrBackupFile($filetpl); |
| 157 | - if (! $result) { |
|
| 157 | + if (!$result) { |
|
| 158 | 158 | return false; |
| 159 | 159 | } |
| 160 | 160 | } else { |
@@ -354,48 +354,48 @@ discard block |
||
| 354 | 354 | if ($objectpage->type_container == 'setup') { |
| 355 | 355 | $content = '<div id="websitetemplateconfigpage">'."\n"; |
| 356 | 356 | $content .= '<?php'."\n"; |
| 357 | - $content .= '/*' . "\n"; |
|
| 358 | - $content .= ' * Actions' . "\n"; |
|
| 359 | - $content .= ' */' . "\n"; |
|
| 360 | - $content .= '$websitetemplateconf = GETPOSTINT(\'websitetemplateconf\');' . "\n"; |
|
| 361 | - $content .= 'include DOL_DOCUMENT_ROOT.\'/core/actions_setmoduleoptions.inc.php\';' . "\n"; |
|
| 362 | - $content .= '' . "\n"; |
|
| 363 | - $content .= '/*' . "\n"; |
|
| 364 | - $content .= ' * View' . "\n"; |
|
| 365 | - $content .= ' */' . "\n"; |
|
| 366 | - $content .= 'print load_fiche_titre($langs->trans(\'SetupAndProperties\'), \'\', \'title_setup\');' . "\n"; |
|
| 367 | - $content .= '' . "\n"; |
|
| 368 | - $content .= 'if (!empty($message)) {' . "\n"; |
|
| 369 | - $content .= ' print $message;' . "\n"; |
|
| 370 | - $content .= '}' . "\n"; |
|
| 371 | - $content .= '' . "\n"; |
|
| 372 | - $content .= 'if (!empty($formSetup->items)) {' . "\n"; |
|
| 373 | - $content .= ' $html = \'\';' . "\n"; |
|
| 374 | - $content .= '' . "\n"; |
|
| 375 | - $content .= ' $html .= \'<form action="config.php" method="POST">\';' . "\n"; |
|
| 376 | - $content .= ' // Generate hidden values from $formSetup->formHiddenInputs' . "\n"; |
|
| 377 | - $content .= ' if (!empty($formSetup->formHiddenInputs) && is_array($formSetup->formHiddenInputs)) {' . "\n"; |
|
| 378 | - $content .= ' foreach ($formSetup->formHiddenInputs as $hiddenKey => $hiddenValue) {' . "\n"; |
|
| 379 | - $content .= ' $html .= \'<input type="hidden" name="\' . dol_escape_htmltag($hiddenKey) . \'" value="\' . dol_escape_htmltag($hiddenValue) . \'">\';' . "\n"; |
|
| 380 | - $content .= ' }' . "\n"; |
|
| 381 | - $content .= ' }' . "\n"; |
|
| 382 | - $content .= '' . "\n"; |
|
| 383 | - $content .= ' // Generate output table' . "\n"; |
|
| 384 | - $content .= ' $html .= $formSetup->generateTableOutput(true);' . "\n"; |
|
| 385 | - $content .= '' . "\n"; |
|
| 386 | - $content .= ' // Submit button' . "\n"; |
|
| 387 | - $content .= ' $html .= \'<input type="hidden" name="action" value="preview">\';' . "\n"; |
|
| 388 | - $content .= ' $html .= \'<input type="hidden" name="websitetemplateconf" value="1">\';' . "\n"; |
|
| 389 | - $content .= ' $html .= \'<br>\';' . "\n"; |
|
| 390 | - $content .= ' $html .= \'<div class="form-setup-button-container center">\';' . "\n"; |
|
| 391 | - $content .= ' $html .= \'<input class="button button-submit" type="submit" value="\' . $langs->trans("Save") . \'">\';' . "\n"; |
|
| 392 | - $content .= ' $html .= \'</div>\';' . "\n"; |
|
| 393 | - $content .= ' $html .= \'</form>\';' . "\n"; |
|
| 394 | - $content .= '' . "\n"; |
|
| 395 | - $content .= ' print $html;' . "\n"; |
|
| 396 | - $content .= '}' . "\n"; |
|
| 397 | - $content .= '?>' . "\n"; |
|
| 398 | - $content .= '</div>' . "\n"; |
|
| 357 | + $content .= '/*'."\n"; |
|
| 358 | + $content .= ' * Actions'."\n"; |
|
| 359 | + $content .= ' */'."\n"; |
|
| 360 | + $content .= '$websitetemplateconf = GETPOSTINT(\'websitetemplateconf\');'."\n"; |
|
| 361 | + $content .= 'include DOL_DOCUMENT_ROOT.\'/core/actions_setmoduleoptions.inc.php\';'."\n"; |
|
| 362 | + $content .= ''."\n"; |
|
| 363 | + $content .= '/*'."\n"; |
|
| 364 | + $content .= ' * View'."\n"; |
|
| 365 | + $content .= ' */'."\n"; |
|
| 366 | + $content .= 'print load_fiche_titre($langs->trans(\'SetupAndProperties\'), \'\', \'title_setup\');'."\n"; |
|
| 367 | + $content .= ''."\n"; |
|
| 368 | + $content .= 'if (!empty($message)) {'."\n"; |
|
| 369 | + $content .= ' print $message;'."\n"; |
|
| 370 | + $content .= '}'."\n"; |
|
| 371 | + $content .= ''."\n"; |
|
| 372 | + $content .= 'if (!empty($formSetup->items)) {'."\n"; |
|
| 373 | + $content .= ' $html = \'\';'."\n"; |
|
| 374 | + $content .= ''."\n"; |
|
| 375 | + $content .= ' $html .= \'<form action="config.php" method="POST">\';'."\n"; |
|
| 376 | + $content .= ' // Generate hidden values from $formSetup->formHiddenInputs'."\n"; |
|
| 377 | + $content .= ' if (!empty($formSetup->formHiddenInputs) && is_array($formSetup->formHiddenInputs)) {'."\n"; |
|
| 378 | + $content .= ' foreach ($formSetup->formHiddenInputs as $hiddenKey => $hiddenValue) {'."\n"; |
|
| 379 | + $content .= ' $html .= \'<input type="hidden" name="\' . dol_escape_htmltag($hiddenKey) . \'" value="\' . dol_escape_htmltag($hiddenValue) . \'">\';'."\n"; |
|
| 380 | + $content .= ' }'."\n"; |
|
| 381 | + $content .= ' }'."\n"; |
|
| 382 | + $content .= ''."\n"; |
|
| 383 | + $content .= ' // Generate output table'."\n"; |
|
| 384 | + $content .= ' $html .= $formSetup->generateTableOutput(true);'."\n"; |
|
| 385 | + $content .= ''."\n"; |
|
| 386 | + $content .= ' // Submit button'."\n"; |
|
| 387 | + $content .= ' $html .= \'<input type="hidden" name="action" value="preview">\';'."\n"; |
|
| 388 | + $content .= ' $html .= \'<input type="hidden" name="websitetemplateconf" value="1">\';'."\n"; |
|
| 389 | + $content .= ' $html .= \'<br>\';'."\n"; |
|
| 390 | + $content .= ' $html .= \'<div class="form-setup-button-container center">\';'."\n"; |
|
| 391 | + $content .= ' $html .= \'<input class="button button-submit" type="submit" value="\' . $langs->trans("Save") . \'">\';'."\n"; |
|
| 392 | + $content .= ' $html .= \'</div>\';'."\n"; |
|
| 393 | + $content .= ' $html .= \'</form>\';'."\n"; |
|
| 394 | + $content .= ''."\n"; |
|
| 395 | + $content .= ' print $html;'."\n"; |
|
| 396 | + $content .= '}'."\n"; |
|
| 397 | + $content .= '?>'."\n"; |
|
| 398 | + $content .= '</div>'."\n"; |
|
| 399 | 399 | $tplcontent .= $content."\n"; |
| 400 | 400 | } |
| 401 | 401 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | |
| 406 | 406 | $tplcontent .= '<?php // BEGIN PHP'."\n"; |
| 407 | 407 | $tplcontent .= '} catch(Exception $e) { print $e->getMessage(); }'."\n"; |
| 408 | - $tplcontent .= '$tmp = ob_get_contents(); ob_end_clean();'."\n"; // replace with ob_get_clean ? |
|
| 408 | + $tplcontent .= '$tmp = ob_get_contents(); ob_end_clean();'."\n"; // replace with ob_get_clean ? |
|
| 409 | 409 | |
| 410 | 410 | $tplcontent .= "// Now fix the content for SEO or multilanguage\n"; |
| 411 | 411 | // Old method for custom SEO |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | $indexcontent .= " require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; |
| 546 | 546 | $indexcontent .= ' redirectToContainer($_GET[\'pageref\'], $_GET[\'pagealiasalt\'], $_GET[\'pageid\']);'."\n"; |
| 547 | 547 | $indexcontent .= "}\n"; |
| 548 | - $indexcontent .= "include_once '".$relpath."/".basename($filetpl)."'\n"; // use .. instead of . |
|
| 548 | + $indexcontent .= "include_once '".$relpath."/".basename($filetpl)."'\n"; // use .. instead of . |
|
| 549 | 549 | $indexcontent .= '// END PHP ?>'."\n"; |
| 550 | 550 | $result = file_put_contents($fileindexsub, $indexcontent); |
| 551 | 551 | if ($result === false) { |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | dol_delete_file($dest.'.zip'); |
| 805 | 805 | |
| 806 | 806 | // Compress it |
| 807 | - global $errormsg; // Used by dol_compress_dir |
|
| 807 | + global $errormsg; // Used by dol_compress_dir |
|
| 808 | 808 | $errormsg = ''; |
| 809 | 809 | $result = dol_compress_dir($src, $dest.'.zip', 'zip'); |
| 810 | 810 | if ($result < 0) { |
@@ -985,7 +985,7 @@ discard block |
||
| 985 | 985 | //$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include", "require_once", "include_once")); |
| 986 | 986 | if (!getDolGlobalString('WEBSITE_PHP_ALLOW_EXEC')) { // If option is not on, we disallow functions to execute commands |
| 987 | 987 | $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("exec", "passthru", "shell_exec", "system", "proc_open", "popen")); |
| 988 | - $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions |
|
| 988 | + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions |
|
| 989 | 989 | $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities |
| 990 | 990 | } |
| 991 | 991 | if (!getDolGlobalString('WEBSITE_PHP_ALLOW_WRITE')) { // If option is not on, we disallow functions to write files |
@@ -999,7 +999,7 @@ discard block |
||
| 999 | 999 | |
| 1000 | 1000 | //$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include")); |
| 1001 | 1001 | |
| 1002 | - $forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function |
|
| 1002 | + $forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function |
|
| 1003 | 1003 | |
| 1004 | 1004 | foreach ($forbiddenphpstrings as $forbiddenphpstring) { |
| 1005 | 1005 | if (preg_match('/'.preg_quote($forbiddenphpstring, '/').'/ims', $phpfullcodestring)) { |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | ]; |
| 106 | 106 | |
| 107 | 107 | $headers = [ |
| 108 | - 'Authorization: Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret), |
|
| 108 | + 'Authorization: Basic '.base64_encode($this->clientId.':'.$this->clientSecret), |
|
| 109 | 109 | 'Content-Type: application/x-www-form-urlencoded', |
| 110 | - 'User-Agent: ' . $this->userAgent |
|
| 110 | + 'User-Agent: '.$this->userAgent |
|
| 111 | 111 | ]; |
| 112 | 112 | |
| 113 | 113 | $result = getURLContent($this->getAuthUrl(), 'POST', http_build_query($authData), 1, $headers, ['http', 'https'], 0); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | return false; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - $cacheFile = $cacheDir . '/' . dol_hash($urlAPI, '3'); |
|
| 146 | + $cacheFile = $cacheDir.'/'.dol_hash($urlAPI, '3'); |
|
| 147 | 147 | $foundInCache = false; |
| 148 | 148 | $data = null; |
| 149 | 149 | |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | if (!$foundInCache) { |
| 160 | 160 | $headers = [ |
| 161 | - 'Authorization: Bearer ' . $this->accessToken, |
|
| 162 | - 'User-Agent: ' . $this->userAgent, |
|
| 161 | + 'Authorization: Bearer '.$this->accessToken, |
|
| 162 | + 'User-Agent: '.$this->userAgent, |
|
| 163 | 163 | ]; |
| 164 | 164 | |
| 165 | 165 | $result = getURLContent($urlAPI, 'GET', '', 1, $headers, ['http', 'https'], 0); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | dolChmod($cacheFile); |
| 174 | 174 | } |
| 175 | 175 | } else { |
| 176 | - $this->error = 'Error retrieving URL ' . $urlAPI; |
|
| 176 | + $this->error = 'Error retrieving URL '.$urlAPI; |
|
| 177 | 177 | return false; |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | 'id' => $postData['id'] ?? '', |
| 220 | 220 | 'content' => $postData['title'] ?? '', |
| 221 | 221 | 'created_at' => $this->formatDate($postData['created'] ?? ''), |
| 222 | - 'url' => 'https://www.reddit.com' . ($postData['permalink'] ?? ''), |
|
| 222 | + 'url' => 'https://www.reddit.com'.($postData['permalink'] ?? ''), |
|
| 223 | 223 | 'media_url' => $postData['thumbnail'] ?? '', |
| 224 | 224 | ]; |
| 225 | 225 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | if (!$foundInCache) { |
| 105 | 105 | $headers = [ |
| 106 | - 'Cookie: ' . $this->getCookieFromParams(), |
|
| 106 | + 'Cookie: '.$this->getCookieFromParams(), |
|
| 107 | 107 | 'Accept: application/json' |
| 108 | 108 | ]; |
| 109 | 109 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | dolChmod($cacheFile); |
| 117 | 117 | } |
| 118 | 118 | } else { |
| 119 | - $this->error = 'Error retrieving URL ' . $urlAPI; |
|
| 119 | + $this->error = 'Error retrieving URL '.$urlAPI; |
|
| 120 | 120 | return false; |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | 'id' => $postData['guid'] ?? '', |
| 162 | 162 | 'content' => strip_tags($postData['text'] ?? $postData['title'] ?? ''), |
| 163 | 163 | 'created_at' => $this->formatDate($postData['created_at'] ?? ''), |
| 164 | - 'url' => 'https://diaspora-fr.org/posts/' . ($postData['guid'] ?? ''), 'media_url' => !empty($postData['photos']) && isset($postData['photos'][0]['url']) ? $postData['photos'][0]['url'] : '', |
|
| 164 | + 'url' => 'https://diaspora-fr.org/posts/'.($postData['guid'] ?? ''), 'media_url' => !empty($postData['photos']) && isset($postData['photos'][0]['url']) ? $postData['photos'][0]['url'] : '', |
|
| 165 | 165 | 'author_name' => $postData['author']['name'] ?? '', |
| 166 | 166 | 'author_avatar' => $postData['author']['avatar']['small'] ?? '' |
| 167 | 167 | ]; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | if (!$foundInCache) { |
| 111 | 111 | $headers = [ |
| 112 | - 'Authorization: Bearer ' . $this->accessToken, |
|
| 112 | + 'Authorization: Bearer '.$this->accessToken, |
|
| 113 | 113 | 'Content-Type: application/json' |
| 114 | 114 | ]; |
| 115 | 115 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | dolChmod($cacheFile); |
| 125 | 125 | } |
| 126 | 126 | } else { |
| 127 | - $this->error = 'Error retrieving URL ' . $urlAPI; |
|
| 127 | + $this->error = 'Error retrieving URL '.$urlAPI; |
|
| 128 | 128 | return false; |
| 129 | 129 | } |
| 130 | 130 | } |