diff --git a/app/Http/Controllers/Auth/ContactLoginController.php b/app/Http/Controllers/Auth/ContactLoginController.php index f741954fbdfa..4074229c5f73 100644 --- a/app/Http/Controllers/Auth/ContactLoginController.php +++ b/app/Http/Controllers/Auth/ContactLoginController.php @@ -35,7 +35,10 @@ class ContactLoginController extends Controller public function showLoginForm(Request $request) { - if (strpos($request->getHost(), 'invoicing.co') !== false) { + //if we are on the root domain invoicing.co do not show any company logos + if(Ninja::isHosted() && count(explode('.', request()->getHost())) == 2){ + $company = null; + }elseif (strpos($request->getHost(), 'invoicing.co') !== false) { $subdomain = explode('.', $request->getHost())[0]; $company = Company::where('subdomain', $subdomain)->first(); } elseif (Ninja::isSelfHost()) { diff --git a/app/Utils/Traits/SubscriptionHooker.php b/app/Utils/Traits/SubscriptionHooker.php index 9da690320ecb..d3c463ff7d92 100644 --- a/app/Utils/Traits/SubscriptionHooker.php +++ b/app/Utils/Traits/SubscriptionHooker.php @@ -37,9 +37,13 @@ trait SubscriptionHooker nlog("method name must be a string"); nlog($subscription->webhook_configuration['post_purchase_rest_method']); + nlog($subscription->webhook_configuration['post_purchase_url']); + + $post_purchase_rest_method = (string)$subscription->webhook_configuration['post_purchase_rest_method']; + $post_purchase_url = (string)$subscription->webhook_configuration['post_purchase_url']; try { - $response = $client->{$subscription->webhook_configuration['post_purchase_rest_method']}($subscription->webhook_configuration['post_purchase_url'],[ + $response = $client->{$post_purchase_rest_method}($post_purchase_url,[ RequestOptions::JSON => ['body' => $body], RequestOptions::ALLOW_REDIRECTS => false ]); diff --git a/composer.json b/composer.json index aac5045c9a80..39b83db35225 100644 --- a/composer.json +++ b/composer.json @@ -47,6 +47,7 @@ "google/apiclient": "^2.7", "guzzlehttp/guzzle": "^7.0.1", "hashids/hashids": "^4.0", + "hedii/laravel-gelf-logger": "^6.0", "intervention/image": "^2.5", "laracasts/presenter": "^0.2.1", "laravel/framework": "^8.0", diff --git a/composer.lock b/composer.lock index 8f7e0b5d340e..a57c955d23f3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "013b0357f14c1782315168bc42234b34", + "content-hash": "cc2b7b338c5d0b4ee700f965bf294772", "packages": [ { "name": "asm/php-ansible", @@ -2450,6 +2450,64 @@ ], "time": "2020-04-13T13:17:36+00:00" }, + { + "name": "graylog2/gelf-php", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/bzikarsky/gelf-php.git", + "reference": "16cab667fa01e6e298af1ec3279fe08d43e40a96" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bzikarsky/gelf-php/zipball/16cab667fa01e6e298af1ec3279fe08d43e40a96", + "reference": "16cab667fa01e6e298af1ec3279fe08d43e40a96", + "shasum": "" + }, + "require": { + "paragonie/constant_time_encoding": "^1|^2", + "php": ">=5.6", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7|^6.5|^7.5", + "squizlabs/php_codesniffer": "^3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-4": { + "Gelf\\": "src/Gelf" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Benjamin Zikarsky", + "email": "benjamin@zikarsky.de" + }, + { + "name": "gelf-php contributors", + "homepage": "https://github.com/bzikarsky/gelf-php/contributors" + } + ], + "description": "A php implementation to send log-messages to a GELF compatible backend like Graylog2.", + "support": { + "issues": "https://github.com/bzikarsky/gelf-php/issues", + "source": "https://github.com/bzikarsky/gelf-php/tree/1.7.0" + }, + "time": "2021-02-04T09:05:55+00:00" + }, { "name": "guzzlehttp/guzzle", "version": "7.3.0", @@ -2753,6 +2811,63 @@ }, "time": "2020-11-26T19:24:33+00:00" }, + { + "name": "hedii/laravel-gelf-logger", + "version": "6.0.0", + "source": { + "type": "git", + "url": "https://github.com/hedii/laravel-gelf-logger.git", + "reference": "231f6dfc41546bfe5e1e02bc85f98d0d5db811c1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hedii/laravel-gelf-logger/zipball/231f6dfc41546bfe5e1e02bc85f98d0d5db811c1", + "reference": "231f6dfc41546bfe5e1e02bc85f98d0d5db811c1", + "shasum": "" + }, + "require": { + "graylog2/gelf-php": "^1.6", + "illuminate/log": "^8.12", + "php": "^7.3|^8.0" + }, + "require-dev": { + "orchestra/testbench": "^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Hedii\\LaravelGelfLogger\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "hedii", + "homepage": "https://hedichaibi.com" + } + ], + "description": "A Laravel package to send logs to a gelf compatible backend like graylog", + "keywords": [ + "gelf", + "graylog", + "graylog2", + "hedii", + "laravel", + "laravel-gelf", + "log", + "logging", + "php", + "udp" + ], + "support": { + "issues": "https://github.com/hedii/laravel-gelf-logger/issues", + "source": "https://github.com/hedii/laravel-gelf-logger" + }, + "time": "2020-11-30T09:39:06+00:00" + }, { "name": "http-interop/http-factory-guzzle", "version": "1.0.0", diff --git a/config/logging.php b/config/logging.php index fc8e2966252f..cfa68f0e57a7 100644 --- a/config/logging.php +++ b/config/logging.php @@ -104,6 +104,69 @@ return [ 'driver' => 'single', 'path' => storage_path('logs/invoiceninja.log'), ], + + 'gelf' => [ + 'driver' => 'custom', + + + 'via' => \Hedii\LaravelGelfLogger\GelfLoggerFactory::class, + + // This optional option determines the processors that should be + // pushed to the handler. This option is useful to modify a field + // in the log context (see NullStringProcessor), or to add extra + // data. Each processor must be a callable or an object with an + // __invoke method: see monolog documentation about processors. + // Default is an empty array. + 'processors' => [ + \Hedii\LaravelGelfLogger\Processors\NullStringProcessor::class, + // another processor... + ], + + // This optional option determines the minimum "level" a message + // must be in order to be logged by the channel. Default is 'debug' + 'level' => 'debug', + + // This optional option determines the channel name sent with the + // message in the 'facility' field. Default is equal to app.env + // configuration value + 'name' => 'my-custom-name', + + // This optional option determines the system name sent with the + // message in the 'source' field. When forgotten or set to null, + // the current hostname is used. + 'system_name' => null, + + // This optional option determines if you want the UDP, TCP or HTTP + // transport for the gelf log messages. Default is UDP + 'transport' => 'udp', + + // This optional option determines the host that will receive the + // gelf log messages. Default is 127.0.0.1 + 'host' => env('GRAYLOG_SERVER', '127.0.0.1'), + + // This optional option determines the port on which the gelf + // receiver host is listening. Default is 12201 + 'port' => 12201, + + // This optional option determines the path used for the HTTP + // transport. When forgotten or set to null, default path '/gelf' + // is used. + 'path' => null, + + // This optional option determines the maximum length per message + // field. When forgotten or set to null, the default value of + // \Monolog\Formatter\GelfMessageFormatter::DEFAULT_MAX_LENGTH is + // used (currently this value is 32766) + 'max_length' => null, + + // This optional option determines the prefix for 'context' fields + // from the Monolog record. Default is null (no context prefix) + 'context_prefix' => null, + + // This optional option determines the prefix for 'extra' fields + // from the Monolog record. Default is null (no extra prefix) + 'extra_prefix' => null, + ], ], ];