FOSSBilling \ Exception
Theme 'dark' does not exist. FOSSBilling\Exception thrown with message "Theme 'dark' does not exist." Stacktrace: #9 FOSSBilling\Exception in /var/www/fossbilling/modules/Theme/Model/Theme.php:25 #8 Box\Mod\Theme\Model\Theme:__construct in /var/www/fossbilling/modules/Theme/Service.php:41 #7 Box\Mod\Theme\Service:getTheme in /var/www/fossbilling/library/Box/AppClient.php:104 #6 Box_AppClient:getTwig in /var/www/fossbilling/library/Box/AppClient.php:85 #5 Box_AppClient:render in /var/www/fossbilling/modules/Order/Controller/Client.php:39 #4 Box\Mod\Order\Controller\Client:get_products in [internal]:0 #3 ReflectionMethod:invokeArgs in /var/www/fossbilling/library/Box/App.php:187 #2 Box_App:executeShared in /var/www/fossbilling/library/Box/App.php:316 #1 Box_App:processRequest in /var/www/fossbilling/library/Box/App.php:129 #0 Box_App:run in /home/kawkavbilling/htdocs/billing.kawkav.com/index.php:89
Stack frames (10)
9
FOSSBilling\Exception
/var/www/fossbilling/modules/Theme/Model/Theme.php:25
8
Box\Mod\Theme\Model\Theme __construct
/var/www/fossbilling/modules/Theme/Service.php:41
7
Box\Mod\Theme\Service getTheme
/var/www/fossbilling/library/Box/AppClient.php:104
6
Box_AppClient getTwig
/var/www/fossbilling/library/Box/AppClient.php:85
5
Box_AppClient render
/var/www/fossbilling/modules/Order/Controller/Client.php:39
4
Box\Mod\Order\Controller\Client get_products
[internal]:0
3
ReflectionMethod invokeArgs
/var/www/fossbilling/library/Box/App.php:187
2
Box_App executeShared
/var/www/fossbilling/library/Box/App.php:316
1
Box_App processRequest
/var/www/fossbilling/library/Box/App.php:129
0
Box_App run
/index.php:89
/var/www/fossbilling/modules/Theme/Model/Theme.php
 * SPDX-License-Identifier: Apache-2.0.
 *
 * @copyright FOSSBilling (https://www.fossbilling.org)
 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache-2.0
 */
 
namespace Box\Mod\Theme\Model;
 
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Path;
 
class Theme
{
    private readonly Filesystem $filesystem;
 
    public function __construct(private $name)
    {
        $this->filesystem = new Filesystem();
        if (!$this->filesystem->exists($this->getPath())) {
            throw new \FOSSBilling\Exception("Theme ':name' does not exist.", [':name' => $name]);
        }
    }
 
    public function getName()
    {
        return $this->name;
    }
 
    public function isAdminAreaTheme()
    {
        return str_contains($this->name, 'admin_');
    }
 
    public function isAssetsPathWritable()
    {
        return is_writable($this->getPathAssets());
    }
 
    /**
     * @return array<mixed, array<'name'|'url', mixed>>
Arguments
  1. "Theme 'dark' does not exist."
    
/var/www/fossbilling/modules/Theme/Service.php
    private readonly Filesystem $filesystem;
 
    public function setDi(\Pimple\Container $di): void
    {
        $this->di = $di;
    }
 
    public function getDi(): ?\Pimple\Container
    {
        return $this->di;
    }
 
    public function __construct()
    {
        $this->filesystem = new Filesystem();
    }
 
    public function getTheme($name)
    {
        return new Model\Theme($name);
    }
 
    public function getCurrentThemePreset(Model\Theme $theme)
    {
        $current = $this->di['db']->getCell(
            "SELECT meta_value
        FROM extension_meta
        WHERE 1
        AND extension = 'mod_theme'
        AND rel_id = 'current'
        AND rel_type = 'preset'
        AND meta_key = :theme",
            [':theme' => $theme->getName()]
        );
        if (empty($current)) {
            $current = $theme->getCurrentPreset();
            $this->setCurrentThemePreset($theme, $current);
        }
 
        return $current;
/var/www/fossbilling/library/Box/AppClient.php
            $template = $this->getTwig()->load(Path::changeExtension($fileName, $ext));
        } catch (Twig\Error\LoaderError $e) {
            $this->di['logger']->setChannel('routing')->info($e->getMessage());
            http_response_code(404);
 
            throw new FOSSBilling\InformationException('Page not found', null, 404);
        }
 
        if ("{$fileName}.{$ext}" == 'mod_page_sitemap.xml') {
            header('Content-Type: application/xml');
        }
 
        return $template->render($variableArray);
    }
 
    protected function getTwig(): Twig\Environment
    {
        $service = $this->di['mod_service']('theme');
        $code = $service->getCurrentClientAreaThemeCode();
        $theme = $service->getTheme($code);
        $settings = $service->getThemeSettings($theme);
 
        $loader = new Box_TwigLoader(
            [
                'mods' => PATH_MODS,
                'theme' => Path::join(PATH_THEMES, $code),
                'type' => 'client',
            ]
        );
 
        $twig = $this->di['twig'];
        $twig->setLoader($loader);
 
        $twig->addGlobal('current_theme', $code);
        $twig->addGlobal('settings', $settings);
 
        if (Environment::isDevelopment()) {
            $profile = new Profile();
            $twig->addExtension(new ProfilerExtension($profile));
            $collector = new NamespacedTwigProfileCollector($profile);
/var/www/fossbilling/library/Box/AppClient.php
        } catch (Exception $e) {
            if (DEBUG) {
                error_log($e->getMessage());
            }
        }
        $e = new FOSSBilling\InformationException('Page :url not found', [':url' => $this->url], 404);
 
        $this->di['logger']->setChannel('routing')->info($e->getMessage());
        http_response_code(404);
 
        return $this->render('error', ['exception' => $e]);
    }
 
    /**
     * @param string $fileName
     */
    public function render($fileName, $variableArray = [], $ext = 'html.twig'): string
    {
        try {
            $template = $this->getTwig()->load(Path::changeExtension($fileName, $ext));
        } catch (Twig\Error\LoaderError $e) {
            $this->di['logger']->setChannel('routing')->info($e->getMessage());
            http_response_code(404);
 
            throw new FOSSBilling\InformationException('Page not found', null, 404);
        }
 
        if ("{$fileName}.{$ext}" == 'mod_page_sitemap.xml') {
            header('Content-Type: application/xml');
        }
 
        return $template->render($variableArray);
    }
 
    protected function getTwig(): Twig\Environment
    {
        $service = $this->di['mod_service']('theme');
        $code = $service->getCurrentClientAreaThemeCode();
        $theme = $service->getTheme($code);
        $settings = $service->getThemeSettings($theme);
/var/www/fossbilling/modules/Order/Controller/Client.php
        $this->di = $di;
    }
 
    public function getDi(): ?\Pimple\Container
    {
        return $this->di;
    }
 
    public function register(\Box_App &$app)
    {
        $app->get('/order', 'get_products', [], static::class);
        $app->get('/order/service', 'get_orders', [], static::class);
        $app->get('/order/:id', 'get_configure_product', ['id' => '[0-9]+'], static::class);
        $app->get('/order/:slug', 'get_configure_product_by_slug', ['slug' => '[a-z0-9-]+'], static::class);
        $app->get('/order/service/manage/:id', 'get_order', ['id' => '[0-9]+'], static::class);
    }
 
    public function get_products(\Box_App $app)
    {
        return $app->render('mod_order_index');
    }
 
    public function get_configure_product_by_slug(\Box_App $app, $slug)
    {
        $api = $this->di['api_guest'];
        $product = $api->product_get(['slug' => $slug]);
        $tpl = 'mod_service' . $product['type'] . '_order';
        if ($api->system_template_exists(['file' => $tpl . '.html.twig'])) {
            return $app->render($tpl, ['product' => $product]);
        }
 
        return $app->render('mod_order_product', ['product' => $product]);
    }
 
    public function get_configure_product(\Box_App $app, $id)
    {
        $api = $this->di['api_guest'];
        $product = $api->product_get(['id' => $id]);
        $tpl = 'mod_service' . $product['type'] . '_order';
        if ($api->system_template_exists(['file' => $tpl . '.html.twig'])) {
[internal]
/var/www/fossbilling/library/Box/App.php
    {
        $this->debugBar['time']->startMeasure('executeShared', 'Reflecting module controller (shared mapping)');
        $class = new $classname();
        if ($class instanceof InjectionAwareInterface) {
            $class->setDi($this->di);
        }
        $reflection = new ReflectionMethod($class::class, $methodName);
        $args = [];
        $args[] = $this; // first param always app instance
 
        foreach ($reflection->getParameters() as $param) {
            if (isset($params[$param->name])) {
                $args[$param->name] = $params[$param->name];
            } elseif ($param->isDefaultValueAvailable()) {
                $args[$param->name] = $param->getDefaultValue();
            }
        }
        $this->debugBar['time']->stopMeasure('executeShared');
 
        return $reflection->invokeArgs($class, $args);
    }
 
    protected function execute($methodName, $params, $classname = null): string
    {
        $this->debugBar['time']->startMeasure('execute', 'Reflecting module controller');
 
        $reflection = new ReflectionMethod(static::class, $methodName);
        $args = [];
 
        foreach ($reflection->getParameters() as $param) {
            if (isset($params[$param->name])) {
                $args[$param->name] = $params[$param->name];
            } elseif ($param->isDefaultValueAvailable()) {
                $args[$param->name] = $param->getDefaultValue();
            }
        }
 
        $this->debugBar['time']->stopMeasure('execute');
 
        return $reflection->invokeArgs($this, $args);
/var/www/fossbilling/library/Box/App.php
                    $exc = new FOSSBilling\InformationException('The system is undergoing maintenance. Please try again later', [], 503);
                    $apiController = new Box\Mod\Api\Controller\Client();
                    $apiController->setDi($this->di);
 
                    return $apiController->renderJson(null, $exc);
                } else {
                    return $this->render('mod_system_maintenance');
                }
            }
        }
 
        $this->debugBar['time']->startMeasure('sharedMapping', 'Checking shared mappings');
        $sharedCount = count($this->shared);
        for ($i = 0; $i < $sharedCount; ++$i) {
            $mapping = $this->shared[$i];
            $url = new Box_UrlHelper($mapping[0], $mapping[1], $mapping[3], $this->url);
            if ($url->match) {
                $this->debugBar['time']->stopMeasure('sharedMapping');
 
                return $this->executeShared($mapping[4], $mapping[2], $url->params);
            }
        }
        $this->debugBar['time']->stopMeasure('sharedMapping');
 
        // this class mappings
        $this->debugBar['time']->startMeasure('mapping', 'Checking mappings');
        $mappingsCount = count($this->mappings);
        for ($i = 0; $i < $mappingsCount; ++$i) {
            $mapping = $this->mappings[$i];
            $url = new Box_UrlHelper($mapping[0], $mapping[1], $mapping[3], $this->url);
            if ($url->match) {
                $this->debugBar['time']->stopMeasure('mapping');
 
                return $this->execute($mapping[2], $url->params);
            }
        }
        $this->debugBar['time']->stopMeasure('mapping');
 
        $e = new FOSSBilling\InformationException('Page :url not found', [':url' => $this->url], 404);
 
/var/www/fossbilling/library/Box/App.php
    public function delete(string $url, string $methodName, ?array $conditions = [], ?string $class = null): void
    {
        $this->event('delete', $url, $methodName, $conditions, $class);
    }
 
    public function run(): string
    {
        $this->debugBar['time']->startMeasure('registerModule', 'Registering module routes');
        $this->registerModule();
        $this->debugBar['time']->stopMeasure('registerModule');
 
        $this->debugBar['time']->startMeasure('init', 'Initializing the app');
        $this->init();
        $this->debugBar['time']->stopMeasure('init');
 
        $this->debugBar['time']->startMeasure('checkperm', 'Checking access to module');
        $this->checkPermission();
        $this->debugBar['time']->stopMeasure('checkperm');
 
        return $this->processRequest();
    }
 
    /**
     * @param string $path
     */
    public function redirect($path): never
    {
        $location = $this->di['url']->link($path);
        header("Location: $location");
        exit;
    }
 
    public function render($fileName, $variableArray = []): string
    {
        return 'Rendering ' . $fileName;
    }
 
    public function sendFile($filename, $contentType, $path): false|int
    {
        header("Content-type: $contentType");
/home/kawkavbilling/htdocs/billing.kawkav.com/index.php
 
// If HTTP error code has been passed, handle it.
if (!is_null($http_err_code)) {
    switch ($http_err_code) {
        case '404':
            $e = new FOSSBilling\Exception('Page :url not found', [':url' => $url], 404);
            echo $app->show404($e);
 
            break;
        default:
            $http_err_code = intval($http_err_code);
            http_response_code($http_err_code);
            $e = new FOSSBilling\Exception('HTTP Error :err_code occurred while attempting to load :url', [':err_code' => $http_err_code, ':url' => $url], $http_err_code);
            echo $app->render('error', ['exception' => $e]);
    }
    exit;
}
 
// If no HTTP error passed, run the app.
echo $app->run();
exit;
 

Environment & details:

Key Value
PHP Version
"8.3.30"
Error code
0
Instance ID
"XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX"
Key Value
_url
"/order"
empty
empty
empty
empty
Key Value
USER
"kawkavbilling"
HOME
"/home/kawkavbilling"
HTTP_REFERER
"http://billing.kawkav.com/order"
HTTP_ACCEPT_ENCODING
"gzip, br, zstd, deflate"
HTTP_USER_AGENT
"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)"
HTTP_ACCEPT
"*/*"
HTTP_CONNECTION
"close"
HTTP_X_FORWARDED_FOR
"216.73.216.99"
HTTP_X_REAL_IP
"216.73.216.99"
HTTP_X_FORWARDED_HOST
"billing.kawkav.com"
HTTP_HOST
"billing.kawkav.com"
PHP_VALUE
"""
\n
error_log=/home/kawkavbilling/logs/php/error.log;\n
memory_limit=512M;\n
max_execution_time=60;\n
max_input_time=60;\n
max_input_vars=10000;\n
post_max_size=64M;\n
upload_max_filesize=64M;\n
date.timezone=UTC;\n
display_errors=off;
"""
HTTPS
"on"
MGT
"1"
GEOIP_LONGITUDE
"-119.1091"
GEOIP_LATITUDE
"34.1453"
GEOIP_CITY_CONTINENT_CODE
"NA"
GEOIP_POSTAL_CODE
"93033"
GEOIP_CITY
"Oxnard"
GEOIP_REGION
"CA"
GEOIP_CITY_COUNTRY_NAME
"United States"
GEOIP_CITY_COUNTRY_CODE3
"USA"
GEOIP_CITY_COUNTRY_CODE
"US"
GEOIP_COUNTRY_NAME
"United States"
GEOIP_COUNTRY_CODE3
"USA"
GEOIP_COUNTRY_CODE
"US"
REDIRECT_STATUS
"200"
SERVER_NAME
"billing.kawkav.com"
SERVER_PORT
"443"
SERVER_ADDR
"127.0.0.1"
REMOTE_PORT
""
REMOTE_ADDR
"216.73.216.99"
SERVER_SOFTWARE
"nginx/1.21.4"
GATEWAY_INTERFACE
"CGI/1.1"
SERVER_PROTOCOL
"HTTP/1.0"
DOCUMENT_ROOT
"/home/kawkavbilling/htdocs/billing.kawkav.com"
DOCUMENT_URI
"/index.php"
REQUEST_URI
"/order"
SCRIPT_NAME
"/index.php"
SCRIPT_FILENAME
"/home/kawkavbilling/htdocs/billing.kawkav.com/index.php"
CONTENT_LENGTH
""
CONTENT_TYPE
""
REQUEST_METHOD
"GET"
QUERY_STRING
""
FCGI_ROLE
"RESPONDER"
PHP_SELF
"/index.php"
REQUEST_TIME_FLOAT
1778244223.3056
REQUEST_TIME
1778244223
empty
0. Whoops\Handler\PrettyPageHandler