From cfa9d88a3bf10d0b0449266dc712a9043cebe338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?CatFlip=E2=84=A2?= Date: Sun, 29 May 2022 19:33:52 -0500 Subject: [PATCH] Fix for company logo image paths Fixed company logo not loading on non-root-path installations --- src/bb-modules/System/Service.php | 12 +++++++++--- src/install/sql/content.sql | 2 +- src/install/sql/content_test.sql | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/bb-modules/System/Service.php b/src/bb-modules/System/Service.php index bd1f55d25..a32f6b2a3 100644 --- a/src/bb-modules/System/Service.php +++ b/src/bb-modules/System/Service.php @@ -97,7 +97,7 @@ class Service $query = "SELECT param, value FROM setting WHERE param IN('".implode("', '", $params)."') - "; + "; $rows = $this->di['db']->getAll($query); $result = []; foreach ($rows as $row) { @@ -128,13 +128,19 @@ class Service ]; $results = $this->_getMultipleParams($c); + $baseurl = $this->di['config']['url']; + $logo_url = $this->di['array_get']($results, 'company_logo', null); + if (null !== $logo_url && false === strpos($logo_url, 'http')) { + $logo_url = $baseurl.$logo_url; + } + return [ - 'www' => $this->di['config']['url'], + 'www' => $baseurl, 'name' => $this->di['array_get']($results, 'company_name', null), 'email' => $this->di['array_get']($results, 'company_email', null), 'tel' => $this->di['array_get']($results, 'company_tel', null), 'signature' => $this->di['array_get']($results, 'company_signature', null), - 'logo_url' => $this->di['array_get']($results, 'company_logo', null), + 'logo_url' => $logo_url, 'address_1' => $this->di['array_get']($results, 'company_address_1', null), 'address_2' => $this->di['array_get']($results, 'company_address_2', null), 'address_3' => $this->di['array_get']($results, 'company_address_3', null), diff --git a/src/install/sql/content.sql b/src/install/sql/content.sql index c10b6e2d3..8dbe496ce 100644 --- a/src/install/sql/content.sql +++ b/src/install/sql/content.sql @@ -350,7 +350,7 @@ VALUES (2,'company_name','Company Name',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'), (3,'company_email','company@email.com',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'), (4,'company_signature','FOSSBilling.org - Client Management, Invoice and Support Software',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'), - (5,'company_logo','/bb-themes/boxbilling/assets/images/logo.png',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'), + (5,'company_logo','bb-themes/boxbilling/assets/images/logo.png',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'), (6,'company_address_1','Demo address line 1',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'), (7,'company_address_2','Demo address line 2',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'), (8,'company_address_3','Demo address line 3',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'), diff --git a/src/install/sql/content_test.sql b/src/install/sql/content_test.sql index cd57a70db..792754436 100644 --- a/src/install/sql/content_test.sql +++ b/src/install/sql/content_test.sql @@ -551,7 +551,7 @@ VALUES (2,'company_name','Demo FOSSBilling.org',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'), (3,'company_email','my@mycompany.com',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'), (4,'company_signature','FOSSBilling.org - Client Management, Invoice and Support Software',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'), - (5,'company_logo','/bb-themes/boxbilling/assets/images/logo.png',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'), + (5,'company_logo','bb-themes/boxbilling/assets/images/logo.png',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'), (6,'company_address_1','Demo address line 1',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'), (7,'company_address_2','Demo address line 2',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'), (8,'company_address_3','Demo address line 3',0,NULL,NULL,'2021-01-01 12:00:00','2021-01-01 12:00:00'),