Files
docset-viewer/config/settings.php
T
2026-06-21 20:42:58 +00:00

68 lines
2.0 KiB
PHP
Executable File

<?php
$debug_env = getenv('APP_DEBUG');
$debug_enabled = $debug_env === false
? true
: filter_var($debug_env, FILTER_VALIDATE_BOOL, FILTER_NULL_ON_FAILURE);
if($debug_enabled === null)
$debug_enabled = true;
$error_reporting_level = $debug_enabled ? E_ALL : (E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_WARNING);
error_reporting($error_reporting_level);
ini_set('display_errors', $debug_enabled ? 'on' : 'off');
define('DATE_FORMAT', 'Y-m-d');
define('DATETIME_FORMAT', 'Y-m-d H:i');
define('ONE_MINUTE', 60);
define('ONE_HOUR', 60 * 60);
define('ONE_DAY', 60 * 60 * 24);
$GLOBALS['config'] = array(
'debug' => array(
'enabled' => $debug_enabled,
'display_errors' => $debug_enabled,
'reporting' => $error_reporting_level,
),
'url' => array(
'pretty' => false,
'root' => '',
'content-type' => 'html',
),
'theme' => array(
'key' => 'docset-light',
'path' => 'themes/docset-light/',
'mode' => 'light',
'label' => 'Docset Viewer',
'footer_text' => 'Docset Viewer - local Zeal/Dash documentation browser.',
'meta_description' => 'Search and browse local Zeal docsets',
'theme_color' => '#f8fafc',
'options' => array(),
),
'site' => array(
'name' => 'Docset Viewer',
'default_page_title' => 'Search Zeal Docsets',
'include_paths' => ['views/', 'components/'],
'autostart_session' => false,
'timezone' => 'UTC',
),
'docsets' => array(
'path' => __DIR__.'/../data/docsets',
'snippet_length' => 180,
'search_limit' => 80,
),
'track' => array('changes' => array()),
'filebase' => array('path' => __DIR__.'/../tmp/'),
'menu' => array(
'' => array('title' => 'Search'),
'docsets' => array('title' => 'Docsets'),
),
);
if(!$GLOBALS['config']['url']['pretty'] && !$GLOBALS['config']['url']['root'])
{
$sroot = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : ($_SERVER['DOCUMENT_URI'] ?? '');
if(substr($sroot, -9) == 'index.php')
$GLOBALS['config']['url']['root'] = substr($sroot, 0, -strlen('index.php'));
}
date_default_timezone_set($GLOBALS['config']['site']['timezone'] ?: 'UTC');