Corrected link in README.md

This commit is contained in:
objecttothis
2022-11-28 12:45:52 +04:00
committed by jekkos
parent 4123d9d8f7
commit 1dd58e922f
288 changed files with 9131 additions and 15582 deletions

22
.editorconfig Normal file
View File

@@ -0,0 +1,22 @@
root = true
[*]
charset = utf-8
end_of_line = crlf
indent_size = 4
indent_style = tab
insert_final_newline = true
max_line_length = 120
tab_width = 4
[{*.cjs,*.js}]
indent_style = tab
[{*.ctp,*.hphp,*.inc,*.module,*.php,*.php4,*.php5,*.phtml}]
indent_style = tab
[{*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.prettierrc,.stylelintrc,bowerrc,composer.lock,jest.config}]
indent_style = tab
[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}]
indent_style = tab

View File

@@ -1,9 +1,15 @@
# redirect to public page
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^public$
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge [NC]
RewriteRule "^(.*)$" "/public/" [R=301,L]
RewriteEngine On
RewriteCond %{REQUEST_URI} !^public$
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge [NC]
RewriteRule "^(.*)$" "/public/" [R=301,L]
# If you installed CodeIgniter in a subfolder, you will need to
# change the following line to match the subfolder you need. Uncomment
# the line below and comment the line above.
#RewriteRule "^(.*)$" "/[SUBDIRECTORY]/public/" [R=301,L]
</IfModule>
# disable directory browsing
@@ -17,7 +23,6 @@ IndexIgnore *
Header always set X-Frame-Options "SAMEORIGIN"
</Ifmodule>
# Apache 2.4
<IfModule authz_core_module>
# secure htaccess file
<Files .htaccess>
@@ -39,34 +44,3 @@ IndexIgnore *
Require all denied
</FilesMatch>
</IfModule>
# Apache 2.2
<IfModule !authz_core_module>
# secure htaccess file
<Files .htaccess>
Order allow,deny
Deny from all
Satisfy all
</Files>
# prevent access to PHP error log
<Files error_log>
Order allow,deny
Deny from all
Satisfy all
</Files>
# prevent access to LICENSE
<Files LICENSE>
Order allow,deny
Deny from all
Satisfy all
</Files>
# prevent access to csv, txt and md files
<FilesMatch "\.(csv|txt|md|yml|json|lock)$">
Order allow,deny
Deny from all
Satisfy all
</FilesMatch>
</IfModule>

View File

@@ -3,4 +3,4 @@
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
</IfModule>

View File

@@ -4,12 +4,12 @@
* The goal of this file is to allow developers a location
* where they can overwrite core procedural functions and
* replace them with their own. This file is loaded during
* the bootstrap process and is called during the frameworks
* the bootstrap process and is called during the framework's
* execution.
*
* This can be looked at as a `master helper` file that is
* loaded early on, and may also contain additional functions
* that you'd like to use throughout your entire application
*
* @link: https://codeigniter4.github.io/CodeIgniter4/
* @see: https://codeigniter4.github.io/CodeIgniter4/
*/

View File

@@ -3,6 +3,7 @@
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Session\Handlers\DatabaseHandler;
class App extends BaseConfig
{
@@ -48,70 +49,74 @@ class App extends BaseConfig
* and path to your installation. However, you should always configure this
* explicitly and never rely on auto-guessing, especially in production
* environments.
*
* @var string
*/
public $baseURL; //Defined in the constructor
public string $baseURL; //Defined in the constructor
/**
* --------------------------------------------------------------------------
* Index File
* --------------------------------------------------------------------------
*
* Typically this will be your index.php file, unless you've renamed it to
* something else. If you are using mod_rewrite to remove the page set this
* variable so that it is blank.
*
* @var string
*/
public $indexPage = '';
/**
* Allowed Hostnames in the Site URL other than the hostname in the baseURL.
* If you want to accept multiple Hostnames, set this.
*
* E.g. When your site URL ($baseURL) is 'http://example.com/', and your site
* also accepts 'http://media.example.com/' and
* 'http://accounts.example.com/':
* ['media.example.com', 'accounts.example.com']
*
* @var string[]
* @phpstan-var list<string>
*/
public array $allowedHostnames = [];
/**
* --------------------------------------------------------------------------
* URI PROTOCOL
* --------------------------------------------------------------------------
*
* This item determines which getServer global should be used to retrieve the
* URI string. The default setting of 'REQUEST_URI' works for most servers.
* If your links do not seem to work, try one of the other delicious flavors:
*
* 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
* 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
* 'PATH_INFO' Uses $_SERVER['PATH_INFO']
*
* WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*
* @var string
*/
public $uriProtocol = 'REQUEST_URI';
/**
* --------------------------------------------------------------------------
* Index File
* --------------------------------------------------------------------------
*
* Typically this will be your index.php file, unless you've renamed it to
* something else. If you are using mod_rewrite to remove the page set this
* variable so that it is blank.
*/
public string $indexPage = '';
/**
* --------------------------------------------------------------------------
* Default Locale
* --------------------------------------------------------------------------
*
* The Locale roughly represents the language and location that your visitor
* is viewing the site from. It affects the language strings and other
* strings (like currency markers, numbers, etc), that your program
* should run under for this request.
*
* @var string
*/
public $defaultLocale = 'en-US';
/**
* --------------------------------------------------------------------------
* URI PROTOCOL
* --------------------------------------------------------------------------
*
* This item determines which server global should be used to retrieve the
* URI string. The default setting of 'REQUEST_URI' works for most servers.
* If your links do not seem to work, try one of the other delicious flavors:
*
* 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
* 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
* 'PATH_INFO' Uses $_SERVER['PATH_INFO']
*
* WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
public string $uriProtocol = 'REQUEST_URI';
/**
* --------------------------------------------------------------------------
* Negotiate Locale
* --------------------------------------------------------------------------
*
* If true, the current Request object will automatically determine the
* language to use based on the value of the Accept-Language header.
*
* If false, no automatic detection will be performed.
*
* @var boolean
*/
public $negotiateLocale = true;
/**
* --------------------------------------------------------------------------
* Default Locale
* --------------------------------------------------------------------------
*
* The Locale roughly represents the language and location that your visitor
* is viewing the site from. It affects the language strings and other
* strings (like currency markers, numbers, etc), that your program
* should run under for this request.
*/
public string $defaultLocale = 'en-US';
/**
* --------------------------------------------------------------------------
* Negotiate Locale
* --------------------------------------------------------------------------
*
* If true, the current Request object will automatically determine the
* language to use based on the value of the Accept-Language header.
*
* If false, no automatic detection will be performed.
*/
public bool $negotiateLocale = true;
/**
* --------------------------------------------------------------------------
@@ -124,7 +129,7 @@ class App extends BaseConfig
*
* @var string[]
*/
public $supportedLocales = [
public array $supportedLocales = [
'ar-EG',
'ar-LB',
'az-AZ',
@@ -168,350 +173,332 @@ class App extends BaseConfig
'zh-Hant',
];
/**
* --------------------------------------------------------------------------
* Application Timezone
* --------------------------------------------------------------------------
*
* The default timezone that will be used in your application to display
* dates with the date helper, and can be retrieved through app_timezone()
*
* @var string
*/
public $appTimezone = 'Asia/Kathmandu';
/**
* --------------------------------------------------------------------------
* Application Timezone
* --------------------------------------------------------------------------
*
* The default timezone that will be used in your application to display
* dates with the date helper, and can be retrieved through app_timezone()
*/
public string $appTimezone = 'UTC';
/**
* --------------------------------------------------------------------------
* Default Character Set
* --------------------------------------------------------------------------
*
* This determines which character set is used by default in various methods
* that require a character set to be provided.
*
* @see http://php.net/htmlspecialchars for a list of supported charsets.
*
* @var string
*/
public $charset = 'UTF-8';
/**
* --------------------------------------------------------------------------
* Default Character Set
* --------------------------------------------------------------------------
*
* This determines which character set is used by default in various methods
* that require a character set to be provided.
*
* @see http://php.net/htmlspecialchars for a list of supported charsets.
*/
public string $charset = 'UTF-8';
/**
* --------------------------------------------------------------------------
* URI PROTOCOL
* --------------------------------------------------------------------------
*
* If true, this will force every request made to this application to be
* made via a secure connection (HTTPS). If the incoming request is not
* secure, the user will be redirected to a secure version of the page
* and the HTTP Strict Transport Security header will be set.
*
* @var boolean
*/
public $forceGlobalSecureRequests = true;
/**
* --------------------------------------------------------------------------
* URI PROTOCOL
* --------------------------------------------------------------------------
*
* If true, this will force every request made to this application to be
* made via a secure connection (HTTPS). If the incoming request is not
* secure, the user will be redirected to a secure version of the page
* and the HTTP Strict Transport Security header will be set.
*/
public bool $forceGlobalSecureRequests = false;
/**
* --------------------------------------------------------------------------
* Session Driver
* --------------------------------------------------------------------------
*
* The session storage driver to use:
* - `CodeIgniter\Session\Handlers\FileHandler`
* - `CodeIgniter\Session\Handlers\DatabaseHandler`
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
* - `CodeIgniter\Session\Handlers\RedisHandler`
*
* @var string
*/
public $sessionDriver = 'CodeIgniter\Session\Handlers\DatabaseHandler';
/**
* --------------------------------------------------------------------------
* Session Driver
* --------------------------------------------------------------------------
*
* The session storage driver to use:
* - `CodeIgniter\Session\Handlers\FileHandler`
* - `CodeIgniter\Session\Handlers\DatabaseHandler`
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
* - `CodeIgniter\Session\Handlers\RedisHandler`
*
* @deprecated use Config\Session::$driver instead.
*/
public string $sessionDriver = DatabaseHandler::class;
/**
* --------------------------------------------------------------------------
* Session Cookie Name
* --------------------------------------------------------------------------
*
* The session cookie name, must contain only [0-9a-z_-] characters
*
* @var string
*/
public $sessionCookieName = 'ospos_session';
/**
* --------------------------------------------------------------------------
* Session Cookie Name
* --------------------------------------------------------------------------
*
* The session cookie name, must contain only [0-9a-z_-] characters
*
* @deprecated use Config\Session::$cookieName instead.
*/
public string $sessionCookieName = 'ospos_session';
/**
* --------------------------------------------------------------------------
* Session Expiration
* --------------------------------------------------------------------------
*
* The number of SECONDS you want the session to last.
* Setting to 0 (zero) means expire when the browser is closed.
*
* @var integer
*/
public $sessionExpiration = 7200;
/**
* --------------------------------------------------------------------------
* Session Expiration
* --------------------------------------------------------------------------
*
* The number of SECONDS you want the session to last.
* Setting to 0 (zero) means expire when the browser is closed.
*
* @deprecated use Config\Session::$expiration instead.
*/
public int $sessionExpiration = 7200;
/**
* --------------------------------------------------------------------------
* Session Save Path
* --------------------------------------------------------------------------
*
* The location to save sessions to and is driver dependent.
*
* For the 'files' driver, it's a path to a writable directory.
* WARNING: Only absolute paths are supported!
*
* For the 'database' driver, it's a table name.
* Please read up the manual for the format with other session drivers.
*
* IMPORTANT: You are REQUIRED to set a valid save path!
*
* @var string
*/
public $sessionSavePath = 'sessions';
/**
* --------------------------------------------------------------------------
* Session Save Path
* --------------------------------------------------------------------------
*
* The location to save sessions to and is driver dependent.
*
* For the 'files' driver, it's a path to a writable directory.
* WARNING: Only absolute paths are supported!
*
* For the 'database' driver, it's a table name.
* Please read up the manual for the format with other session drivers.
*
* IMPORTANT: You are REQUIRED to set a valid save path!
*
* @deprecated use Config\Session::$savePath instead.
*/
public string $sessionSavePath = 'sessions';
/**
* --------------------------------------------------------------------------
* Session Match IP
* --------------------------------------------------------------------------
*
* Whether to match the user's IP address when reading the session data.
*
* WARNING: If you're using the database driver, don't forget to update
* your session table's PRIMARY KEY when changing this setting.
*
* @var boolean
*/
public $sessionMatchIP = true;
/**
* --------------------------------------------------------------------------
* Session Match IP
* --------------------------------------------------------------------------
*
* Whether to match the user's IP address when reading the session data.
*
* WARNING: If you're using the database driver, don't forget to update
* your session table's PRIMARY KEY when changing this setting.
*
* @deprecated use Config\Session::$matchIP instead.
*/
public bool $sessionMatchIP = true;
/**
* --------------------------------------------------------------------------
* Session Time to Update
* --------------------------------------------------------------------------
*
* How many seconds between CI regenerating the session ID.
*
* @var integer
*/
public $sessionTimeToUpdate = 300;
/**
* --------------------------------------------------------------------------
* Session Time to Update
* --------------------------------------------------------------------------
*
* How many seconds between CI regenerating the session ID.
*
* @deprecated use Config\Session::$timeToUpdate instead.
*/
public int $sessionTimeToUpdate = 300;
/**
* --------------------------------------------------------------------------
* Session Regenerate Destroy
* --------------------------------------------------------------------------
*
* Whether to destroy session data associated with the old session ID
* when auto-regenerating the session ID. When set to FALSE, the data
* will be later deleted by the garbage collector.
*
* @var boolean
*/
public $sessionRegenerateDestroy = false;
/**
* --------------------------------------------------------------------------
* Session Regenerate Destroy
* --------------------------------------------------------------------------
*
* Whether to destroy session data associated with the old session ID
* when auto-regenerating the session ID. When set to FALSE, the data
* will be later deleted by the garbage collector.
*
* @deprecated use Config\Session::$regenerateDestroy instead.
*/
public bool $sessionRegenerateDestroy = false;
/**
* --------------------------------------------------------------------------
* Cookie Prefix
* --------------------------------------------------------------------------
*
* Set a cookie name prefix if you need to avoid collisions.
*
* @var string
*
* @deprecated use Config\Cookie::$prefix property instead.
*/
public $cookiePrefix = '';
/**
* --------------------------------------------------------------------------
* Session Database Group
* --------------------------------------------------------------------------
*
* DB Group for the database session.
*
* @deprecated use Config\Session::$DBGroup instead.
*/
public ?string $sessionDBGroup = null;
/**
* --------------------------------------------------------------------------
* Cookie Domain
* --------------------------------------------------------------------------
*
* Set to `.your-domain.com` for site-wide cookies.
*
* @var string
*
* @deprecated use Config\Cookie::$domain property instead.
*/
public $cookieDomain = '';
/**
* --------------------------------------------------------------------------
* Cookie Prefix
* --------------------------------------------------------------------------
*
* Set a cookie name prefix if you need to avoid collisions.
*
* @deprecated use Config\Cookie::$prefix property instead.
*/
public string $cookiePrefix = '';
/**
* --------------------------------------------------------------------------
* Cookie Path
* --------------------------------------------------------------------------
*
* Typically will be a forward slash.
*
* @var string
*
* @deprecated use Config\Cookie::$path property instead.
*/
public $cookiePath = '/';
/**
* --------------------------------------------------------------------------
* Cookie Domain
* --------------------------------------------------------------------------
*
* Set to `.your-domain.com` for site-wide cookies.
*
* @deprecated use Config\Cookie::$domain property instead.
*/
public string $cookieDomain = '';
/**
* --------------------------------------------------------------------------
* Cookie Secure
* --------------------------------------------------------------------------
*
* Cookie will only be set if a secure HTTPS connection exists.
*
* @var boolean
*
* @deprecated use Config\Cookie::$secure property instead.
*/
public $cookieSecure;
/**
* --------------------------------------------------------------------------
* Cookie Path
* --------------------------------------------------------------------------
*
* Typically will be a forward slash.
*
* @deprecated use Config\Cookie::$path property instead.
*/
public string $cookiePath = '/';
/**
* --------------------------------------------------------------------------
* Cookie HttpOnly
* --------------------------------------------------------------------------
*
* Cookie will only be accessible via HTTP(S) (no JavaScript).
*
* @var boolean
*
* @deprecated use Config\Cookie::$httponly property instead.
*/
public $cookieHTTPOnly = true;
/**
* --------------------------------------------------------------------------
* Cookie Secure
* --------------------------------------------------------------------------
*
* Cookie will only be set if a secure HTTPS connection exists.
*
* @deprecated use Config\Cookie::$secure property instead.
*/
public bool $cookieSecure = false;
/**
* --------------------------------------------------------------------------
* Cookie SameSite
* --------------------------------------------------------------------------
*
* Configure cookie SameSite setting. Allowed values are:
* - None
* - Lax
* - Strict
* - ''
*
* Alternatively, you can use the constant names:
* - `Cookie::SAMESITE_NONE`
* - `Cookie::SAMESITE_LAX`
* - `Cookie::SAMESITE_STRICT`
*
* Defaults to `Lax` for compatibility with modern browsers. Setting `''`
* (empty string) means default SameSite attribute set by browsers (`Lax`)
* will be set on cookies. If set to `None`, `$cookieSecure` must also be set.
*
* @var string
*
* @deprecated use Config\Cookie::$samesite property instead.
*/
public $cookieSameSite = 'Lax';
/**
* --------------------------------------------------------------------------
* Cookie HttpOnly
* --------------------------------------------------------------------------
*
* Cookie will only be accessible via HTTP(S) (no JavaScript).
*
* @deprecated use Config\Cookie::$httponly property instead.
*/
public bool $cookieHTTPOnly = true;
/**
* --------------------------------------------------------------------------
* Reverse Proxy IPs
* --------------------------------------------------------------------------
*
* If your server is behind a reverse proxy, you must whitelist the proxy
* IP addresses from which CodeIgniter should trust headers such as
* HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
* the visitor's IP address.
*
* You can use both an array or a comma-separated list of proxy addresses,
* as well as specifying whole subnets. Here are a few examples:
*
* Comma-separated: '10.0.1.200,192.168.5.0/24'
* Array: ['10.0.1.200', '192.168.5.0/24']
*
* @var string|string[]
*/
public $proxyIPs = '';
/**
* --------------------------------------------------------------------------
* Cookie SameSite
* --------------------------------------------------------------------------
*
* Configure cookie SameSite setting. Allowed values are:
* - None
* - Lax
* - Strict
* - ''
*
* Alternatively, you can use the constant names:
* - `Cookie::SAMESITE_NONE`
* - `Cookie::SAMESITE_LAX`
* - `Cookie::SAMESITE_STRICT`
*
* Defaults to `Lax` for compatibility with modern browsers. Setting `''`
* (empty string) means default SameSite attribute set by browsers (`Lax`)
* will be set on cookies. If set to `None`, `$cookieSecure` must also be set.
*
* @deprecated use Config\Cookie::$samesite property instead.
*/
public ?string $cookieSameSite = 'Lax';
/**
* --------------------------------------------------------------------------
* CSRF Token Name
* --------------------------------------------------------------------------
*
* The token name.
*
* @deprecated Use `Config\Security` $tokenName property instead of using this property.
*
* @var string
*/
public $CSRFTokenName;
/**
* --------------------------------------------------------------------------
* Reverse Proxy IPs
* --------------------------------------------------------------------------
*
* If your server is behind a reverse proxy, you must whitelist the proxy
* IP addresses from which CodeIgniter should trust headers such as
* X-Forwarded-For or Client-IP in order to properly identify
* the visitor's IP address.
*
* You need to set a proxy IP address or IP address with subnets and
* the HTTP header for the client IP address.
*
* Here are some examples:
* [
* '10.0.1.200' => 'X-Forwarded-For',
* '192.168.5.0/24' => 'X-Real-IP',
* ]
*
* @var array<string, string>
*/
public array $proxyIPs = [];
/**
* --------------------------------------------------------------------------
* CSRF Header Name
* --------------------------------------------------------------------------
*
* The header name.
*
* @deprecated Use `Config\Security` $headerName property instead of using this property.
*
* @var string
*/
public $CSRFHeaderName = 'X-CSRF-TOKEN';
/**
* --------------------------------------------------------------------------
* CSRF Token Name
* --------------------------------------------------------------------------
*
* The token name.
*
* @deprecated Use `Config\Security` $tokenName property instead of using this property.
*/
public string $CSRFTokenName = 'csrf_ospos_v4';
/**
* --------------------------------------------------------------------------
* CSRF Cookie Name
* --------------------------------------------------------------------------
*
* The cookie name.
*
* @deprecated Use `Config\Security` $cookieName property instead of using this property.
*
* @var string
*/
public $CSRFCookieName;
/**
* --------------------------------------------------------------------------
* CSRF Header Name
* --------------------------------------------------------------------------
*
* The header name.
*
* @deprecated Use `Config\Security` $headerName property instead of using this property.
*/
public string $CSRFHeaderName = 'X-CSRF-TOKEN';
/**
* --------------------------------------------------------------------------
* CSRF Expire
* --------------------------------------------------------------------------
*
* The number in seconds the token should expire.
*
* @deprecated Use `Config\Security` $expire property instead of using this property.
*
* @var integer
*/
public $CSRFExpire = 7200;
/**
* --------------------------------------------------------------------------
* CSRF Cookie Name
* --------------------------------------------------------------------------
*
* The cookie name.
*
* @deprecated Use `Config\Security` $cookieName property instead of using this property.
*/
public string $CSRFCookieName = 'csrf_cookie_ospos_v4';
/**
* --------------------------------------------------------------------------
* CSRF Regenerate
* --------------------------------------------------------------------------
*
* Regenerate token on every submission?
*
* @deprecated Use `Config\Security` $regenerate property instead of using this property.
*
* @var boolean
*/
public $CSRFRegenerate = true;
/**
* --------------------------------------------------------------------------
* CSRF Expire
* --------------------------------------------------------------------------
*
* The number in seconds the token should expire.
*
* @deprecated Use `Config\Security` $expire property instead of using this property.
*/
public int $CSRFExpire = 7200;
/**
* --------------------------------------------------------------------------
* CSRF Redirect
* --------------------------------------------------------------------------
*
* Redirect to previous page with error on failure?
*
* @deprecated Use `Config\Security` $redirect property instead of using this property.
*
* @var boolean
*/
public $CSRFRedirect = true;
/**
* --------------------------------------------------------------------------
* CSRF Regenerate
* --------------------------------------------------------------------------
*
* Regenerate token on every submission?
*
* @deprecated Use `Config\Security` $regenerate property instead of using this property.
*/
public bool $CSRFRegenerate = true;
/**
* --------------------------------------------------------------------------
* CSRF SameSite
* --------------------------------------------------------------------------
*
* Setting for CSRF SameSite cookie token. Allowed values are:
* - None
* - Lax
* - Strict
* - ''
*
* Defaults to `Lax` as recommended in this link:
*
* @see https://portswigger.net/web-security/csrf/samesite-cookies
*
* @deprecated Use `Config\Security` $samesite property instead of using this property.
*
* @var string
*/
public $CSRFSameSite = 'Lax';
/**
* --------------------------------------------------------------------------
* CSRF Redirect
* --------------------------------------------------------------------------
*
* Redirect to previous page with error on failure?
*
* @deprecated Use `Config\Security` $redirect property instead of using this property.
*/
public bool $CSRFRedirect = false;
/**
* --------------------------------------------------------------------------
* CSRF SameSite
* --------------------------------------------------------------------------
*
* Setting for CSRF SameSite cookie token. Allowed values are:
* - None
* - Lax
* - Strict
* - ''
*
* Defaults to `Lax` as recommended in this link:
*
* @see https://portswigger.net/web-security/csrf/samesite-cookies
*
* @deprecated `Config\Cookie` $samesite property is used.
*/
public string $CSRFSameSite = 'Lax';
/**
* --------------------------------------------------------------------------
@@ -528,10 +515,8 @@ class App extends BaseConfig
*
* @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/
* @see http://www.w3.org/TR/CSP/
*
* @var boolean
*/
public $CSPEnabled = false;
public bool $CSPEnabled = false; //TODO: We need to enable this either as part of 3.4.0 release or shortly after. It will be an undertaking to whitelist everything, but it's imperative to block XSS attacks
public function __construct()
{

View File

@@ -17,52 +17,51 @@ use CodeIgniter\Config\AutoloadConfig;
*/
class Autoload extends AutoloadConfig
{
/**
* -------------------------------------------------------------------
* Namespaces
* -------------------------------------------------------------------
* This maps the locations of any namespaces in your application to
* their location on the file system. These are used by the autoloader
* to locate files the first time they have been instantiated.
*
* The '/app' and '/system' directories are already mapped for you.
* you may change the name of the 'App' namespace if you wish,
* but this should be done prior to creating any namespaced classes,
* else you will need to modify all of those classes for this to work.
*
* Prototype:
*```
* $psr4 = [
* 'CodeIgniter' => SYSTEMPATH,
* 'App' => APPPATH
* ];
*```
* @var array<string, string>
*/
public $psr4 = [
APP_NAMESPACE => APPPATH, // For custom app namespace
'Config' => APPPATH . 'Config',
/**
* -------------------------------------------------------------------
* Namespaces
* -------------------------------------------------------------------
* This maps the locations of any namespaces in your application to
* their location on the file system. These are used by the autoloader
* to locate files the first time they have been instantiated.
*
* The '/app' and '/system' directories are already mapped for you.
* you may change the name of the 'App' namespace if you wish,
* but this should be done prior to creating any namespaced classes,
* else you will need to modify all of those classes for this to work.
*
* Prototype:
* $psr4 = [
* 'CodeIgniter' => SYSTEMPATH,
* 'App' => APPPATH
* ];
*
* @var array<string, array<int, string>|string>
* @phpstan-var array<string, string|list<string>>
*/
public $psr4 = [
APP_NAMESPACE => APPPATH, // For custom app namespace
'Config' => APPPATH . 'Config',
'dompdf' => APPPATH . 'ThirdParty/dompdf/src'
];
];
/**
* -------------------------------------------------------------------
* Class Map
* -------------------------------------------------------------------
* The class map provides a map of class names and their exact
* location on the drive. Classes loaded in this manner will have
* slightly faster performance because they will not have to be
* searched for within one or more directories as they would if they
* were being autoloaded through a namespace.
*
* Prototype:
*```
* $classmap = [
* 'MyClass' => '/path/to/class/file.php'
* ];
*```
* @var array<string, string>
*/
/**
* -------------------------------------------------------------------
* Class Map
* -------------------------------------------------------------------
* The class map provides a map of class names and their exact
* location on the drive. Classes loaded in this manner will have
* slightly faster performance because they will not have to be
* searched for within one or more directories as they would if they
* were being autoloaded through a namespace.
*
* Prototype:
* $classmap = [
* 'MyClass' => '/path/to/class/file.php'
* ];
*
* @var array<string, string>
*/
public $classmap = [
//Controllers
'Attributes' => '/App/Controllers/Attributes.php',
@@ -173,21 +172,35 @@ class Autoload extends AutoloadConfig
'Rounding_mode' => '/App/Models/Enums/Rounding_mode.php'
];
/**
* -------------------------------------------------------------------
* Files
* -------------------------------------------------------------------
* The files array provides a list of paths to __non-class__ files
* that will be autoloaded. This can be useful for bootstrap operations
* or for loading functions.
*
* Prototype:
* ```
* $files = [
* '/path/to/my/file.php',
* ];
* ```
* @var array<int, string>
*/
public $files = [];
}
/**
* -------------------------------------------------------------------
* Files
* -------------------------------------------------------------------
* The files array provides a list of paths to __non-class__ files
* that will be autoloaded. This can be useful for bootstrap operations
* or for loading functions.
*
* Prototype:
* $files = [
* '/path/to/my/file.php',
* ];
*
* @var string[]
* @phpstan-var list<string>
*/
public $files = [];
/**
* -------------------------------------------------------------------
* Helpers
* -------------------------------------------------------------------
* Prototype:
* $helpers = [
* 'form',
* ];
*
* @var string[]
* @phpstan-var list<string>
*/
public $helpers = [];
}

View File

@@ -0,0 +1,20 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class CURLRequest extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CURLRequest Share Options
* --------------------------------------------------------------------------
*
* Whether share options between requests or not.
*
* If true, all the options won't be reset between requests.
* It may cause an error request with unnecessary headers.
*/
public bool $shareOptions = true;
}

View File

@@ -12,156 +12,158 @@ use CodeIgniter\Config\BaseConfig;
class Cache extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Primary Handler
* --------------------------------------------------------------------------
*
* The name of the preferred handler that should be used. If for some reason
* it is not available, the $backupHandler will be used in its place.
*
* @var string
*/
public $handler = 'file';
/**
* --------------------------------------------------------------------------
* Primary Handler
* --------------------------------------------------------------------------
*
* The name of the preferred handler that should be used. If for some reason
* it is not available, the $backupHandler will be used in its place.
*/
public string $handler = 'file';
/**
* --------------------------------------------------------------------------
* Backup Handler
* --------------------------------------------------------------------------
*
* The name of the handler that will be used in case the first one is
* unreachable. Often, 'file' is used here since the filesystem is
* always available, though that's not always practical for the app.
*
* @var string
*/
public $backupHandler = 'dummy';
/**
* --------------------------------------------------------------------------
* Backup Handler
* --------------------------------------------------------------------------
*
* The name of the handler that will be used in case the first one is
* unreachable. Often, 'file' is used here since the filesystem is
* always available, though that's not always practical for the app.
*/
public string $backupHandler = 'dummy';
/**
* --------------------------------------------------------------------------
* Cache Directory Path
* --------------------------------------------------------------------------
*
* The path to where cache files should be stored, if using a file-based
* system.
*
* @var string
*
* @deprecated Use the driver-specific variant under $file
*/
public $storePath = WRITEPATH . 'cache/';
/**
* --------------------------------------------------------------------------
* Cache Directory Path
* --------------------------------------------------------------------------
*
* The path to where cache files should be stored, if using a file-based
* system.
*
* @deprecated Use the driver-specific variant under $file
*/
public string $storePath = WRITEPATH . 'cache/';
/**
* --------------------------------------------------------------------------
* Cache Include Query String
* --------------------------------------------------------------------------
*
* Whether to take the URL query string into consideration when generating
* output cache files. Valid options are:
*
* false = Disabled
* true = Enabled, take all query parameters into account.
* Please be aware that this may result in numerous cache
* files generated for the same page over and over again.
* ['q') = Enabled, but only take into account the specified list
* of query parameters.
*
* @var boolean|string[]
*/
public $cacheQueryString = false;
/**
* --------------------------------------------------------------------------
* Cache Include Query String
* --------------------------------------------------------------------------
*
* Whether to take the URL query string into consideration when generating
* output cache files. Valid options are:
*
* false = Disabled
* true = Enabled, take all query parameters into account.
* Please be aware that this may result in numerous cache
* files generated for the same page over and over again.
* array('q') = Enabled, but only take into account the specified list
* of query parameters.
*
* @var bool|string[]
*/
public $cacheQueryString = false;
/**
* --------------------------------------------------------------------------
* Key Prefix
* --------------------------------------------------------------------------
*
* This string is added to all cache item names to help avoid collisions
* if you run multiple applications with the same cache engine.
*
* @var string
*/
public $prefix = '';
/**
* --------------------------------------------------------------------------
* Key Prefix
* --------------------------------------------------------------------------
*
* This string is added to all cache item names to help avoid collisions
* if you run multiple applications with the same cache engine.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Default TTL
* --------------------------------------------------------------------------
*
* The default number of seconds to save items when none is specified.
*
* WARNING: This is not used by framework handlers where 60 seconds is
* hard-coded, but may be useful to projects and modules. This will replace
* the hard-coded value in a future release.
*
* @var integer
*/
public $ttl = 60;
/**
* --------------------------------------------------------------------------
* Default TTL
* --------------------------------------------------------------------------
*
* The default number of seconds to save items when none is specified.
*
* WARNING: This is not used by framework handlers where 60 seconds is
* hard-coded, but may be useful to projects and modules. This will replace
* the hard-coded value in a future release.
*/
public int $ttl = 60;
/**
* --------------------------------------------------------------------------
* File settings
* --------------------------------------------------------------------------
* Your file storage preferences can be specified below, if you are using
* the File driver.
*
* @var array<string, string|int|null>
*/
public $file = [
'storePath' => WRITEPATH . 'cache/',
'mode' => 0640,
];
/**
* --------------------------------------------------------------------------
* Reserved Characters
* --------------------------------------------------------------------------
*
* A string of reserved characters that will not be allowed in keys or tags.
* Strings that violate this restriction will cause handlers to throw.
* Default: {}()/\@:
* Note: The default set is required for PSR-6 compliance.
*/
public string $reservedCharacters = '{}()/\@:';
/**
* -------------------------------------------------------------------------
* Memcached settings
* -------------------------------------------------------------------------
* Your Memcached servers can be specified below, if you are using
* the Memcached drivers.
*
* @see https://codeigniter.com/user_guide/libraries/caching.html#memcached
*
* @var array<string, string|int|boolean>
*/
public $memcached = [
'host' => '127.0.0.1',
'port' => 11211,
'weight' => 1,
'raw' => false,
];
/**
* --------------------------------------------------------------------------
* File settings
* --------------------------------------------------------------------------
* Your file storage preferences can be specified below, if you are using
* the File driver.
*
* @var array<string, int|string|null>
*/
public array $file = [
'storePath' => WRITEPATH . 'cache/',
'mode' => 0640,
];
/**
* -------------------------------------------------------------------------
* Redis settings
* -------------------------------------------------------------------------
* Your Redis server can be specified below, if you are using
* the Redis or Predis drivers.
*
* @var array<string, string|int|null>
*/
public $redis = [
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'timeout' => 0,
'database' => 0,
];
/**
* -------------------------------------------------------------------------
* Memcached settings
* -------------------------------------------------------------------------
* Your Memcached servers can be specified below, if you are using
* the Memcached drivers.
*
* @see https://codeigniter.com/user_guide/libraries/caching.html#memcached
*
* @var array<string, bool|int|string>
*/
public array $memcached = [
'host' => '127.0.0.1',
'port' => 11211,
'weight' => 1,
'raw' => false,
];
/**
* --------------------------------------------------------------------------
* Available Cache Handlers
* --------------------------------------------------------------------------
*
* This is an array of cache engine alias' and class names. Only engines
* that are listed here are allowed to be used.
*
* @var array<string, string>
*/
public $validHandlers = [
'dummy' => DummyHandler::class,
'file' => FileHandler::class,
'memcached' => MemcachedHandler::class,
'predis' => PredisHandler::class,
'redis' => RedisHandler::class,
'wincache' => WincacheHandler::class,
];
/**
* -------------------------------------------------------------------------
* Redis settings
* -------------------------------------------------------------------------
* Your Redis server can be specified below, if you are using
* the Redis or Predis drivers.
*
* @var array<string, int|string|null>
*/
public array $redis = [
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'timeout' => 0,
'database' => 0,
];
/**
* --------------------------------------------------------------------------
* Available Cache Handlers
* --------------------------------------------------------------------------
*
* This is an array of cache engine alias' and class names. Only engines
* that are listed here are allowed to be used.
*
* @var array<string, string>
*/
public array $validHandlers = [
'dummy' => DummyHandler::class,
'file' => FileHandler::class,
'memcached' => MemcachedHandler::class,
'predis' => PredisHandler::class,
'redis' => RedisHandler::class,
'wincache' => WincacheHandler::class,
];
}

View File

@@ -1,82 +1,98 @@
<?php
/**
* --------------------------------------------------------------------
* App Namespace
* --------------------------------------------------------------------
*
* This defines the default Namespace that is used throughout
* CodeIgniter to refer to the Application directory. Change
* this constant to change the namespace that all application
* classes should use.
*
* NOTE: changing this will require manually modifying the
* existing namespaces of App\* namespaced-classes.
/*
| --------------------------------------------------------------------
| App Namespace
| --------------------------------------------------------------------
|
| This defines the default Namespace that is used throughout
| CodeIgniter to refer to the Application directory. Change
| this constant to change the namespace that all application
| classes should use.
|
| NOTE: changing this will require manually modifying the
| existing namespaces of App\* namespaced-classes.
*/
defined('APP_NAMESPACE') || define('APP_NAMESPACE', 'App');
/**
* --------------------------------------------------------------------------
* Composer Path
* --------------------------------------------------------------------------
*
* The path that Composer's autoload file is expected to live. By default,
* the vendor folder is in the Root directory, but you can customize that here.
/*
| --------------------------------------------------------------------------
| Composer Path
| --------------------------------------------------------------------------
|
| The path that Composer's autoload file is expected to live. By default,
| the vendor folder is in the Root directory, but you can customize that here.
*/
defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php');
/**
* --------------------------------------------------------------------------
* Timing Constants
* --------------------------------------------------------------------------
*
* Provide simple ways to work with the myriad of PHP functions that
* require information to be in seconds.
/*
|--------------------------------------------------------------------------
| Timing Constants
|--------------------------------------------------------------------------
|
| Provide simple ways to work with the myriad of PHP functions that
| require information to be in seconds.
*/
defined('SECOND') || define('SECOND', 1);
defined('MINUTE') || define('MINUTE', 60);
defined('HOUR') || define('HOUR', 3600);
defined('DAY') || define('DAY', 86400);
defined('WEEK') || define('WEEK', 604800);
defined('MONTH') || define('MONTH', 2592000);
defined('YEAR') || define('YEAR', 31536000);
defined('DECADE') || define('DECADE', 315360000);
defined('MONTH') || define('MONTH', 2_592_000);
defined('YEAR') || define('YEAR', 31_536_000);
defined('DECADE') || define('DECADE', 315_360_000);
/*
| --------------------------------------------------------------------------
| Exit Status Codes
| --------------------------------------------------------------------------
|
| Used to indicate the conditions under which the script is exit()ing.
| While there is no universal standard for error codes, there are some
| broad conventions. Three such conventions are mentioned below, for
| those who wish to make use of them. The CodeIgniter defaults were
| chosen for the least overlap with these conventions, while still
| leaving room for others to be defined in future versions and user
| applications.
|
| The three main conventions used for determining exit status codes
| are as follows:
|
| Standard C/C++ Library (stdlibc):
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
| (This link also contains other GNU-specific conventions)
| BSD sysexits.h:
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
| Bash scripting:
| http://tldp.org/LDP/abs/html/exitcodes.html
|
*/
defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
/**
* --------------------------------------------------------------------------
* Exit Status Codes
* --------------------------------------------------------------------------
*
* Used to indicate the conditions under which the script is exit()ing.
* While there is no universal standard for error codes, there are some
* broad conventions. Three such conventions are mentioned below, for
* those who wish to make use of them. The CodeIgniter defaults were
* chosen for the least overlap with these conventions, while still
* leaving room for others to be defined in future versions and user
* applications.
*
* The three main conventions used for determining exit status codes
* are as follows:
*
* Standard C/C++ Library (stdlibc):
* http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
* (This link also contains other GNU-specific conventions)
* BSD sysexits.h:
* http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
* Bash scripting:
* http://tldp.org/LDP/abs/html/exitcodes.html
*
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead.
*/
defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
define('EVENT_PRIORITY_LOW', 200);
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_NORMAL instead.
*/
define('EVENT_PRIORITY_NORMAL', 100);
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
*/
define('EVENT_PRIORITY_HIGH', 10);
/**
* Attribute Related Constants.

View File

@@ -15,153 +15,162 @@ use CodeIgniter\Config\BaseConfig;
*/
class ContentSecurityPolicy extends BaseConfig
{
//-------------------------------------------------------------------------
// Broadbrush CSP management
//-------------------------------------------------------------------------
// -------------------------------------------------------------------------
// Broadbrush CSP management
// -------------------------------------------------------------------------
/**
* Default CSP report context
*
* @var boolean
*/
public $reportOnly = false;
/**
* Default CSP report context
*/
public bool $reportOnly = false;
/**
* Specifies a URL where a browser will send reports
* when a content security policy is violated.
*
* @var string|null
*/
public $reportURI = null;
/**
* Specifies a URL where a browser will send reports
* when a content security policy is violated.
*/
public ?string $reportURI = null;
/**
* Instructs user agents to rewrite URL schemes, changing
* HTTP to HTTPS. This directive is for websites with
* large numbers of old URLs that need to be rewritten.
*
* @var boolean
*/
public $upgradeInsecureRequests = false;
/**
* Instructs user agents to rewrite URL schemes, changing
* HTTP to HTTPS. This directive is for websites with
* large numbers of old URLs that need to be rewritten.
*/
public bool $upgradeInsecureRequests = false;
//-------------------------------------------------------------------------
// Sources allowed
// Note: once you set a policy to 'none', it cannot be further restricted
//-------------------------------------------------------------------------
// -------------------------------------------------------------------------
// Sources allowed
// Note: once you set a policy to 'none', it cannot be further restricted
// -------------------------------------------------------------------------
/**
* Will default to self if not overridden
*
* @var string|string[]|null
*/
public $defaultSrc = null;
/**
* Will default to self if not overridden
*
* @var string|string[]|null
*/
public $defaultSrc;
/**
* Lists allowed scripts' URLs.
*
* @var string|string[]
*/
public $scriptSrc = 'self';
/**
* Lists allowed scripts' URLs.
*
* @var string|string[]
*/
public $scriptSrc = 'self';
/**
* Lists allowed stylesheets' URLs.
*
* @var string|string[]
*/
public $styleSrc = 'self';
/**
* Lists allowed stylesheets' URLs.
*
* @var string|string[]
*/
public $styleSrc = 'self';
/**
* Defines the origins from which images can be loaded.
*
* @var string|string[]
*/
public $imageSrc = 'self';
/**
* Defines the origins from which images can be loaded.
*
* @var string|string[]
*/
public $imageSrc = 'self';
/**
* Restricts the URLs that can appear in a page's `<base>` element.
*
* Will default to self if not overridden
*
* @var string|string[]|null
*/
public $baseURI = null;
/**
* Restricts the URLs that can appear in a page's `<base>` element.
*
* Will default to self if not overridden
*
* @var string|string[]|null
*/
public $baseURI;
/**
* Lists the URLs for workers and embedded frame contents
*
* @var string|string[]
*/
public $childSrc = 'self';
/**
* Lists the URLs for workers and embedded frame contents
*
* @var string|string[]
*/
public $childSrc = 'self';
/**
* Limits the origins that you can connect to (via XHR,
* WebSockets, and EventSource).
*
* @var string|string[]
*/
public $connectSrc = 'self';
/**
* Limits the origins that you can connect to (via XHR,
* WebSockets, and EventSource).
*
* @var string|string[]
*/
public $connectSrc = 'self';
/**
* Specifies the origins that can serve web fonts.
*
* @var string|string[]
*/
public $fontSrc = null;
/**
* Specifies the origins that can serve web fonts.
*
* @var string|string[]
*/
public $fontSrc;
/**
* Lists valid endpoints for submission from `<form>` tags.
*
* @var string|string[]
*/
public $formAction = 'self';
/**
* Lists valid endpoints for submission from `<form>` tags.
*
* @var string|string[]
*/
public $formAction = 'self';
/**
* Specifies the sources that can embed the current page.
* This directive applies to `<frame>`, `<iframe>`, `<embed>`,
* and `<applet>` tags. This directive can't be used in
* `<meta>` tags and applies only to non-HTML resources.
*
* @var string|string[]|null
*/
public $frameAncestors = null;
/**
* Specifies the sources that can embed the current page.
* This directive applies to `<frame>`, `<iframe>`, `<embed>`,
* and `<applet>` tags. This directive can't be used in
* `<meta>` tags and applies only to non-HTML resources.
*
* @var string|string[]|null
*/
public $frameAncestors;
/**
* The frame-src directive restricts the URLs which may
* be loaded into nested browsing contexts.
*
* @var array|string|null
*/
public $frameSrc = null;
/**
* The frame-src directive restricts the URLs which may
* be loaded into nested browsing contexts.
*
* @var array|string|null
*/
public $frameSrc;
/**
* Restricts the origins allowed to deliver video and audio.
*
* @var string|string[]|null
*/
public $mediaSrc = null;
/**
* Restricts the origins allowed to deliver video and audio.
*
* @var string|string[]|null
*/
public $mediaSrc;
/**
* Allows control over Flash and other plugins.
*
* @var string|string[]
*/
public $objectSrc = 'self';
/**
* Allows control over Flash and other plugins.
*
* @var string|string[]
*/
public $objectSrc = 'self';
/**
* @var string|string[]|null
*/
public $manifestSrc = null;
/**
* @var string|string[]|null
*/
public $manifestSrc;
/**
* Limits the kinds of plugins a page may invoke.
*
* @var string|string[]|null
*/
public $pluginTypes = null;
/**
* Limits the kinds of plugins a page may invoke.
*
* @var string|string[]|null
*/
public $pluginTypes;
/**
* List of actions allowed.
*
* @var string|string[]|null
*/
public $sandbox = null;
/**
* List of actions allowed.
*
* @var string|string[]|null
*/
public $sandbox;
/**
* Nonce tag for style
*/
public string $styleNonceTag = '{csp-style-nonce}';
/**
* Nonce tag for script
*/
public string $scriptNonceTag = '{csp-script-nonce}';
/**
* Replace nonce tag automatically
*/
public bool $autoNonce = true;
}

View File

@@ -7,120 +7,99 @@ use DateTimeInterface;
class Cookie extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Cookie Prefix
* --------------------------------------------------------------------------
*
* Set a cookie name prefix if you need to avoid collisions.
*
* @var string
*/
public $prefix = '';
/**
* --------------------------------------------------------------------------
* Cookie Prefix
* --------------------------------------------------------------------------
*
* Set a cookie name prefix if you need to avoid collisions.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Cookie Expires Timestamp
* --------------------------------------------------------------------------
*
* Default expires timestamp for cookies. Setting this to `0` will mean the
* cookie will not have the `Expires` attribute and will behave as a session
* cookie.
*
* @var DateTimeInterface|integer|string
*/
public $expires = 0;
/**
* --------------------------------------------------------------------------
* Cookie Expires Timestamp
* --------------------------------------------------------------------------
*
* Default expires timestamp for cookies. Setting this to `0` will mean the
* cookie will not have the `Expires` attribute and will behave as a session
* cookie.
*
* @var DateTimeInterface|int|string
*/
public $expires = 0;
/**
* --------------------------------------------------------------------------
* Cookie Path
* --------------------------------------------------------------------------
*
* Typically will be a forward slash.
*
* @var string
*/
public $path = '/';
/**
* --------------------------------------------------------------------------
* Cookie Path
* --------------------------------------------------------------------------
*
* Typically will be a forward slash.
*/
public string $path = '/';
/**
* --------------------------------------------------------------------------
* Cookie Domain
* --------------------------------------------------------------------------
*
* Set to `.your-domain.com` for site-wide cookies.
*
* @var string
*/
public $domain = '';
/**
* --------------------------------------------------------------------------
* Cookie Domain
* --------------------------------------------------------------------------
*
* Set to `.your-domain.com` for site-wide cookies.
*/
public string $domain = '';
/**
* --------------------------------------------------------------------------
* Cookie Secure
* --------------------------------------------------------------------------
*
* Cookie will only be set if a secure HTTPS connection exists.
*
* @var boolean
*/
public $secure;
/**
* --------------------------------------------------------------------------
* Cookie Secure
* --------------------------------------------------------------------------
*
* Cookie will only be set if a secure HTTPS connection exists.
*/
public bool $secure = false;
/**
* --------------------------------------------------------------------------
* Cookie HTTPOnly
* --------------------------------------------------------------------------
*
* Cookie will only be accessible via HTTP(S) (no JavaScript).
*
* @var boolean
*/
public $httponly = true;
/**
* --------------------------------------------------------------------------
* Cookie HTTPOnly
* --------------------------------------------------------------------------
*
* Cookie will only be accessible via HTTP(S) (no JavaScript).
*/
public bool $httponly = true;
/**
* --------------------------------------------------------------------------
* Cookie SameSite
* --------------------------------------------------------------------------
*
* Configure cookie SameSite setting. Allowed values are:
* - None
* - Lax
* - Strict
* - ''
*
* Alternatively, you can use the constant names:
* - `Cookie::SAMESITE_NONE`
* - `Cookie::SAMESITE_LAX`
* - `Cookie::SAMESITE_STRICT`
*
* Defaults to `Lax` for compatibility with modern browsers. Setting `''`
* (empty string) means default SameSite attribute set by browsers (`Lax`)
* will be set on cookies. If set to `None`, `$secure` must also be set.
*
* @var string
*/
public $samesite = 'Lax';
/**
* --------------------------------------------------------------------------
* Cookie SameSite
* --------------------------------------------------------------------------
*
* Configure cookie SameSite setting. Allowed values are:
* - None
* - Lax
* - Strict
* - ''
*
* Alternatively, you can use the constant names:
* - `Cookie::SAMESITE_NONE`
* - `Cookie::SAMESITE_LAX`
* - `Cookie::SAMESITE_STRICT`
*
* Defaults to `Lax` for compatibility with modern browsers. Setting `''`
* (empty string) means default SameSite attribute set by browsers (`Lax`)
* will be set on cookies. If set to `None`, `$secure` must also be set.
*/
public string $samesite = 'Lax';
/**
* --------------------------------------------------------------------------
* Cookie Raw
* --------------------------------------------------------------------------
*
* This flag allows setting a "raw" cookie, i.e., its name and value are
* not URL encoded using `rawurlencode()`.
*
* If this is set to `true`, cookie names should be compliant of RFC 2616's
* list of allowed characters.
*
* @var boolean
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
* @see https://tools.ietf.org/html/rfc2616#section-2.2
*/
public $raw = false;
function __construct()
{
parent::__construct();
$config = config('App');
$this->secure = $config->https_on;
}
/**
* --------------------------------------------------------------------------
* Cookie Raw
* --------------------------------------------------------------------------
*
* This flag allows setting a "raw" cookie, i.e., its name and value are
* not URL encoded using `rawurlencode()`.
*
* If this is set to `true`, cookie names should be compliant of RFC 2616's
* list of allowed characters.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
* @see https://tools.ietf.org/html/rfc2616#section-2.2
*/
public bool $raw = false;
}

View File

@@ -9,28 +9,22 @@ use CodeIgniter\Database\Config;
*/
class Database extends Config
{
/**
* The directory that holds the Migrations
* and Seeds directories.
*
* @var string
*/
public $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
/**
* The directory that holds the Migrations
* and Seeds directories.
*/
public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
/**
* Lets you choose which connection group to
* use if no other is specified.
*
* @var string
*/
public $defaultGroup = 'default';
/**
* Lets you choose which connection group to
* use if no other is specified.
*/
public string $defaultGroup = 'default';
/**
* The default database connection.
*
* @var array
*/
public $default = [
public array $default = [
'DSN' => '',
'hostname' => 'localhost',
'username' => 'admin',
@@ -50,14 +44,11 @@ class Database extends Config
'port' => 3306
];
/**
* This database connection is used when
* running PHPUnit database tests.
*
* @var array
*/
public $tests = [
public array $tests = [
'DSN' => '',
'hostname' => 'localhost',
'username' => 'admin',
@@ -74,7 +65,9 @@ class Database extends Config
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306
'port' => 3306,
'foreignKeys' => true,
'busyTimeout' => 1000,
];
/**
@@ -100,16 +93,18 @@ class Database extends Config
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306
'port' => 3306,
'foreignKeys' => true,
'busyTimeout' => 1000,
];
public function __construct()
{
parent::__construct();
public function __construct()
{
parent::__construct();
// Ensure that we always set the database group to 'tests' if
// we are currently running an automated test suite, so that
// we don't overwrite live data on accident.
// Ensure that we always set the database group to 'tests' if
// we are currently running an automated test suite, so that
// we don't overwrite live data on accident.
switch(ENVIRONMENT)
{
case 'testing':
@@ -119,5 +114,5 @@ class Database extends Config
$this->defaultGroup = 'development';
break;
}
}
}
}

View File

@@ -4,30 +4,40 @@ namespace Config;
class DocTypes
{
/**
* List of valid document types.
*
* @var array<string, string>
*/
public $list = [
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
'html5' => '<!DOCTYPE html>',
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">',
];
/**
* List of valid document types.
*
* @var array<string, string>
*/
public array $list = [
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
'html5' => '<!DOCTYPE html>',
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">',
];
/**
* Whether to remove the solidus (`/`) character for void HTML elements (e.g. `<input>`)
* for HTML5 compatibility.
*
* Set to:
* `true` - to be HTML5 compatible
* `false` - to be XHTML compatible
*/
public bool $html5 = true;
}

View File

@@ -6,166 +6,112 @@ use CodeIgniter\Config\BaseConfig;
class Email extends BaseConfig
{
/**
* @var string
*/
public $fromEmail;
public string $fromEmail = 'noreply@opensourcepos.org';
public string $fromName = 'Opensource Point of Sale';
public string $recipients = 'blackhole@none.com';
/**
* @var string
*/
public $fromName;
/**
* The "user agent"
*/
public string $userAgent = 'CodeIgniter';
/**
* @var string
*/
public $recipients;
/**
* The mail sending protocol: mail, sendmail, smtp
*/
public string $protocol = 'mail';
/**
* The "user agent"
*
* @var string
*/
public $userAgent = 'CodeIgniter';
/**
* The server path to Sendmail.
*/
public string $mailPath = '/usr/sbin/sendmail';
/**
* The mail sending protocol: mail, sendmail, smtp
*
* @var string
*/
public $protocol = 'mail';
/**
* SMTP Server Address
*/
public string $SMTPHost = 'mail.mxserver.com';
/**
* The server path to Sendmail.
*
* @var string
*/
public $mailPath = '/usr/sbin/sendmail';
/**
* SMTP Username
*/
public string $SMTPUser = 'user';
/**
* SMTP Server Address
*
* @var string
*/
public $SMTPHost;
/**
* SMTP Password
*/
public string $SMTPPass = 'pass';
/**
* SMTP Username
*
* @var string
*/
public $SMTPUser;
/**
* SMTP Port
*/
public int $SMTPPort = 25;
/**
* SMTP Password
*
* @var string
*/
public $SMTPPass;
/**
* SMTP Timeout (in seconds)
*/
public int $SMTPTimeout = 5;
/**
* SMTP Port
*
* @var integer
*/
public $SMTPPort = 25;
/**
* Enable persistent SMTP connections
*/
public bool $SMTPKeepAlive = false;
/**
* SMTP Timeout (in seconds)
*
* @var integer
*/
public $SMTPTimeout = 5;
/**
* SMTP Encryption. Either tls or ssl
*/
public string $SMTPCrypto = 'tls';
/**
* Enable persistent SMTP connections
*
* @var boolean
*/
public $SMTPKeepAlive = false;
/**
* Enable word-wrap
*/
public bool $wordWrap = true;
/**
* SMTP Encryption. Either tls or ssl
*
* @var string
*/
public $SMTPCrypto = 'tls';
/**
* Character count to wrap at
*/
public int $wrapChars = 76;
/**
* Enable word-wrap
*
* @var boolean
*/
public $wordWrap = true;
/**
* Type of mail, either 'text' or 'html'
*/
public string $mailType = 'html';
/**
* Character count to wrap at
*
* @var integer
*/
public $wrapChars = 76;
/**
* Character set (utf-8, iso-8859-1, etc.)
*/
public string $charset = 'UTF-8';
/**
* Type of mail, either 'text' or 'html'
*
* @var string
*/
public $mailType = 'text';
/**
* Whether to validate the email address
*/
public bool $validate = false;
/**
* Character set (utf-8, iso-8859-1, etc.)
*
* @var string
*/
public $charset = 'UTF-8';
/**
* Email Priority. 1 = highest. 5 = lowest. 3 = normal
*/
public int $priority = 3;
/**
* Whether to validate the email address
*
* @var boolean
*/
public $validate = false;
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $CRLF = "\r\n";
/**
* Email Priority. 1 = highest. 5 = lowest. 3 = normal
*
* @var integer
*/
public $priority = 3;
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $newline = "\r\n";
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*
* @var string
*/
public $CRLF = "\r\n";
/**
* Enable BCC Batch Mode.
*/
public bool $BCCBatchMode = false;
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*
* @var string
*/
public $newline = "\r\n";
/**
* Enable BCC Batch Mode.
*
* @var boolean
*/
public $BCCBatchMode = false;
/**
* Number of emails in each BCC batch
*
* @var integer
*/
public $BCCBatchSize = 200;
/**
* Enable notify message from server
*
* @var boolean
*/
public $DSN = false;
/**
* Number of emails in each BCC batch
*/
public int $BCCBatchSize = 200;
/**
* Enable notify message from server
*/
public bool $DSN = false;
}

View File

@@ -12,62 +12,72 @@ use CodeIgniter\Config\BaseConfig;
*/
class Encryption extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Encryption Key Starter
* --------------------------------------------------------------------------
*
* If you use the Encryption class you must set an encryption key (seed).
* You need to ensure it is long enough for the cipher and mode you plan to use.
* See the user guide for more info.
*
* @var string
*/
public $key; //Set in the constructor
/**
* --------------------------------------------------------------------------
* Encryption Key Starter
* --------------------------------------------------------------------------
*
* If you use the Encryption class you must set an encryption key (seed).
* You need to ensure it is long enough for the cipher and mode you plan to use.
* See the user guide for more info.
*/
public string $key = '';
/**
* --------------------------------------------------------------------------
* Encryption Driver to Use
* --------------------------------------------------------------------------
*
* One of the supported encryption drivers.
*
* Available drivers:
* - OpenSSL
* - Sodium
*
* @var string
*/
public $driver = 'OpenSSL';
/**
* --------------------------------------------------------------------------
* Encryption Driver to Use
* --------------------------------------------------------------------------
*
* One of the supported encryption drivers.
*
* Available drivers:
* - OpenSSL
* - Sodium
*/
public string $driver = 'OpenSSL';
/**
* --------------------------------------------------------------------------
* SodiumHandler's Padding Length in Bytes
* --------------------------------------------------------------------------
*
* This is the number of bytes that will be padded to the plaintext message
* before it is encrypted. This value should be greater than zero.
*
* See the user guide for more information on padding.
*
* @var integer
*/
public $blockSize = 16;
/**
* --------------------------------------------------------------------------
* SodiumHandler's Padding Length in Bytes
* --------------------------------------------------------------------------
*
* This is the number of bytes that will be padded to the plaintext message
* before it is encrypted. This value should be greater than zero.
*
* See the user guide for more information on padding.
*/
public int $blockSize = 16;
/**
* --------------------------------------------------------------------------
* Encryption digest
* --------------------------------------------------------------------------
*
* HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'.
*
* @var string
*/
public $digest = 'SHA512';
/**
* --------------------------------------------------------------------------
* Encryption digest
* --------------------------------------------------------------------------
*
* HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'.
*/
public string $digest = 'SHA512';
function __construct()
{
parent::__construct();
$this->key = getenv('ENCRYPTION_KEY') !== FALSE ? getenv('ENCRYPTION_KEY') : '';
}
/**
* Whether the cipher-text should be raw. If set to false, then it will be base64 encoded.
* This setting is only used by OpenSSLHandler.
*
* Set to false for CI3 Encryption compatibility.
*/
public bool $rawData = true;
/**
* Encryption key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'encryption' for CI3 Encryption compatibility.
*/
public string $encryptKeyInfo = '';
/**
* Authentication key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'authentication' for CI3 Encryption compatibility.
*/
public string $authKeyInfo = '';
}

View File

@@ -2,7 +2,9 @@
namespace Config;
use App\Events\Db_log;
use App\Events\Load_config;
use App\Events\Method;
use CodeIgniter\Events\Events;
use CodeIgniter\Exceptions\FrameworkException;
@@ -23,39 +25,34 @@ use CodeIgniter\Exceptions\FrameworkException;
* Events::on('create', [$myInstance, 'myMethod']);
*/
Events::on('pre_system', function ()
{
if (ENVIRONMENT !== 'testing')
{
if (ini_get('zlib.output_compression'))
{
throw FrameworkException::forEnabledZlibOutputCompression();
}
Events::on('pre_system', static function () {
if (ENVIRONMENT !== 'testing') {
if (ini_get('zlib.output_compression')) {
throw FrameworkException::forEnabledZlibOutputCompression();
}
while (ob_get_level() > 0)
{
ob_end_flush();
}
while (ob_get_level() > 0) {
ob_end_flush();
}
ob_start(static function ($buffer){ return $buffer; });
}
ob_start(static fn ($buffer) => $buffer);
}
/*
* --------------------------------------------------------------------
* Debug Toolbar Listeners.
* --------------------------------------------------------------------
* If you delete, they will no longer be collected.
*/
if (CI_DEBUG && !is_cli())
{
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
Services::toolbar()->respond();
}
/*
* --------------------------------------------------------------------
* Debug Toolbar Listeners.
* --------------------------------------------------------------------
* If you delete, they will no longer be collected.
*/
if (CI_DEBUG && ! is_cli()) {
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
Services::toolbar()->respond();
}
});
$config = new Load_config(); //TODO: Not 100% sure this is the best way to do this, but without instantiating the class, the event engine tries to run the function as if it were static.
$config = new Load_config();
Events::on('post_controller_constructor', [$config, 'load_config']);
Events::on('post_controller', ['\App\Events\Db_log', 'db_log_queries']);
Events::on('post_controller', [Db_log::class, 'db_log_queries']);
Events::on('pre_controller', ['\App\Events\Method', 'validate_method']);
Events::on('pre_controller', [Method::class, 'validate_method']);

View File

@@ -3,58 +3,75 @@
namespace Config;
use CodeIgniter\Config\BaseConfig;
use Psr\Log\LogLevel;
/**
* Setup how the exception handler works.
*/
class Exceptions extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* LOG EXCEPTIONS?
* --------------------------------------------------------------------------
* If true, then exceptions will be logged
* through Services::Log.
*
* Default: true
*
* @var boolean
*/
public $log = true;
/**
* --------------------------------------------------------------------------
* LOG EXCEPTIONS?
* --------------------------------------------------------------------------
* If true, then exceptions will be logged
* through Services::Log.
*
* Default: true
*/
public bool $log = true;
/**
* --------------------------------------------------------------------------
* DO NOT LOG STATUS CODES
* --------------------------------------------------------------------------
* Any status codes here will NOT be logged if logging is turned on.
* By default, only 404 (Page Not Found) exceptions are ignored.
*
* @var array
*/
public $ignoreCodes = [404];
/**
* --------------------------------------------------------------------------
* DO NOT LOG STATUS CODES
* --------------------------------------------------------------------------
* Any status codes here will NOT be logged if logging is turned on.
* By default, only 404 (Page Not Found) exceptions are ignored.
*/
public array $ignoreCodes = [404];
/**
* --------------------------------------------------------------------------
* Error Views Path
* --------------------------------------------------------------------------
* This is the path to the directory that contains the 'cli' and 'html'
* directories that hold the views used to generate errors.
*
* Default: APPPATH.'Views/errors'
*
* @var string
*/
public $errorViewPath = APPPATH . 'Views/errors';
/**
* --------------------------------------------------------------------------
* Error Views Path
* --------------------------------------------------------------------------
* This is the path to the directory that contains the 'cli' and 'html'
* directories that hold the views used to generate errors.
*
* Default: APPPATH.'Views/errors'
*/
public string $errorViewPath = APPPATH . 'Views/errors';
/**
* --------------------------------------------------------------------------
* HIDE FROM DEBUG TRACE
* --------------------------------------------------------------------------
* Any data that you would like to hide from the debug trace.
* In order to specify 2 levels, use "/" to separate.
* ex. ['server', 'setup/password', 'secret_token']
*
* @var array
*/
public $sensitiveDataInTrace = [];
/**
* --------------------------------------------------------------------------
* HIDE FROM DEBUG TRACE
* --------------------------------------------------------------------------
* Any data that you would like to hide from the debug trace.
* In order to specify 2 levels, use "/" to separate.
* ex. ['server', 'setup/password', 'secret_token']
*/
public array $sensitiveDataInTrace = [];
/**
* --------------------------------------------------------------------------
* LOG DEPRECATIONS INSTEAD OF THROWING?
* --------------------------------------------------------------------------
* By default, CodeIgniter converts deprecations into exceptions. Also,
* starting in PHP 8.1 will cause a lot of deprecated usage warnings.
* Use this option to temporarily cease the warnings and instead log those.
* This option also works for user deprecations.
*/
public bool $logDeprecations = true;
/**
* --------------------------------------------------------------------------
* LOG LEVEL THRESHOLD FOR DEPRECATIONS
* --------------------------------------------------------------------------
* If `$logDeprecations` is set to `true`, this sets the log level
* to which the deprecation will be logged. This should be one of the log
* levels recognized by PSR-3.
*
* The related `Config\Logger::$threshold` should be adjusted, if needed,
* to capture logging the deprecations.
*/
public string $deprecationLogLevel = LogLevel::WARNING;
}

30
app/Config/Feature.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Enable/disable backward compatibility breaking features.
*/
class Feature extends BaseConfig
{
/**
* Enable multiple filters for a route or not.
*
* If you enable this:
* - CodeIgniter\CodeIgniter::handleRequest() uses:
* - CodeIgniter\Filters\Filters::enableFilters(), instead of enableFilter()
* - CodeIgniter\CodeIgniter::tryToRouteIt() uses:
* - CodeIgniter\Router\Router::getFilters(), instead of getFilter()
* - CodeIgniter\Router\Router::handle() uses:
* - property $filtersInfo, instead of $filterInfo
* - CodeIgniter\Router\RouteCollection::getFiltersForRoute(), instead of getFilterForRoute()
*/
public bool $multipleFilters = false;
/**
* Use improved new auto routing instead of the default legacy version.
*/
public bool $autoRoutesImproved = true;
}

View File

@@ -6,57 +6,59 @@ use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Filters\CSRF;
use CodeIgniter\Filters\DebugToolbar;
use CodeIgniter\Filters\Honeypot;
use CodeIgniter\Filters\InvalidChars;
use CodeIgniter\Filters\SecureHeaders;
class Filters extends BaseConfig
{
/**
* Configures aliases for Filter classes to
* make reading things nicer and simpler.
*
* @var array
*/
public $aliases = [
'csrf' => CSRF::class,
'toolbar' => DebugToolbar::class,
'honeypot' => Honeypot::class,
];
/**
* Configures aliases for Filter classes to
* make reading things nicer and simpler.
*/
public array $aliases = [
'csrf' => CSRF::class,
'toolbar' => DebugToolbar::class,
'honeypot' => Honeypot::class,
'invalidchars' => InvalidChars::class,
'secureheaders' => SecureHeaders::class,
];
/**
* List of filter aliases that are always
* applied before and after every request.
*
* @var array
*/
public $globals = [
'before' => [
'honeypot',
'csrf' => ['except' => 'login']
],
'after' => [
'toolbar',
'honeypot',
],
];
/**
* List of filter aliases that are always
* applied before and after every request.
*/
public array $globals = [
'before' => [
'honeypot',
//'csrf' => ['except' => 'login'], //TODO: Temporarily disable CSRF until we get everything sorted.
'invalidchars',
],
'after' => [
'toolbar',
'honeypot',
'secureheaders',
],
];
/**
* List of filter aliases that works on a
* particular HTTP method (GET, POST, etc.).
*
* Example:
* 'post' => ['csrf', 'throttle']
*
* @var array
*/
public $methods = [];
/**
* List of filter aliases that works on a
* particular HTTP method (GET, POST, etc.).
*
* Example:
* 'post' => ['foo', 'bar']
*
* If you use this, you should disable auto-routing because auto-routing
* permits any HTTP method to access a controller. Accessing the controller
* with a method you dont expect could bypass the filter.
*/
public array $methods = [];
/**
* List of filter aliases that should run on any
* before or after URI patterns.
*
* Example:
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
*
* @var array
*/
public $filters = [];
/**
* List of filter aliases that should run on any
* before or after URI patterns.
*
* Example:
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
*/
public array $filters = [];
}

View File

@@ -4,73 +4,74 @@ namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Format\FormatterInterface;
use CodeIgniter\Format\JSONFormatter;
use CodeIgniter\Format\XMLFormatter;
class Format extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Available Response Formats
* --------------------------------------------------------------------------
*
* When you perform content negotiation with the request, these are the
* available formats that your application supports. This is currently
* only used with the API\ResponseTrait. A valid Formatter must exist
* for the specified format.
*
* These formats are only checked when the data passed to the respond()
* method is an array.
*
* @var string[]
*/
public $supportedResponseFormats = [
'application/json',
'application/xml', // machine-readable XML
'text/xml', // human-readable XML
];
/**
* --------------------------------------------------------------------------
* Available Response Formats
* --------------------------------------------------------------------------
*
* When you perform content negotiation with the request, these are the
* available formats that your application supports. This is currently
* only used with the API\ResponseTrait. A valid Formatter must exist
* for the specified format.
*
* These formats are only checked when the data passed to the respond()
* method is an array.
*
* @var string[]
*/
public array $supportedResponseFormats = [
'application/json',
'application/xml', // machine-readable XML
'text/xml', // human-readable XML
];
/**
* --------------------------------------------------------------------------
* Formatters
* --------------------------------------------------------------------------
*
* Lists the class to use to format responses with of a particular type.
* For each mime type, list the class that should be used. Formatters
* can be retrieved through the getFormatter() method.
*
* @var array<string, string>
*/
public $formatters = [
'application/json' => 'CodeIgniter\Format\JSONFormatter',
'application/xml' => 'CodeIgniter\Format\XMLFormatter',
'text/xml' => 'CodeIgniter\Format\XMLFormatter',
];
/**
* --------------------------------------------------------------------------
* Formatters
* --------------------------------------------------------------------------
*
* Lists the class to use to format responses with of a particular type.
* For each mime type, list the class that should be used. Formatters
* can be retrieved through the getFormatter() method.
*
* @var array<string, string>
*/
public array $formatters = [
'application/json' => JSONFormatter::class,
'application/xml' => XMLFormatter::class,
'text/xml' => XMLFormatter::class,
];
/**
* --------------------------------------------------------------------------
* Formatters Options
* --------------------------------------------------------------------------
*
* Additional Options to adjust default formatters behaviour.
* For each mime type, list the additional options that should be used.
*
* @var array<string, int>
*/
public $formatterOptions = [
'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
'application/xml' => 0,
'text/xml' => 0,
];
/**
* --------------------------------------------------------------------------
* Formatters Options
* --------------------------------------------------------------------------
*
* Additional Options to adjust default formatters behaviour.
* For each mime type, list the additional options that should be used.
*
* @var array<string, int>
*/
public array $formatterOptions = [
'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
'application/xml' => 0,
'text/xml' => 0,
];
//--------------------------------------------------------------------
/**
* A Factory method to return the appropriate formatter for the given mime type.
* @param string $mime
* @return FormatterInterface
* @deprecated This is an alias of `\CodeIgniter\Format\Format::getFormatter`. Use that instead.
*/
public function getFormatter(string $mime): FormatterInterface
{
return Services::format()->getFormatter($mime);
}
/**
* A Factory method to return the appropriate formatter for the given mime type.
*
* @return FormatterInterface
*
* @deprecated This is an alias of `\CodeIgniter\Format\Format::getFormatter`. Use that instead.
*/
public function getFormatter(string $mime)
{
return Services::format()->getFormatter($mime);
}
}

View File

@@ -6,34 +6,35 @@ use CodeIgniter\Config\BaseConfig;
class Generators extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Generator Commands' Views
* --------------------------------------------------------------------------
*
* This array defines the mapping of generator commands to the view files
* they are using. If you need to customize them for your own, copy these
* view files in your own folder and indicate the location here.
*
* You will notice that the views have special placeholders enclosed in
* curly braces `{...}`. These placeholders are used internally by the
* generator commands in processing replacements, thus you are warned
* not to delete them or modify the names. If you will do so, you may
* end up disrupting the scaffolding process and throw errors.
*
* YOU HAVE BEEN WARNED!
*
* @var array<string, string>
*/
public $views = [
'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php',
'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php',
'make:entity' => 'CodeIgniter\Commands\Generators\Views\entity.tpl.php',
'make:filter' => 'CodeIgniter\Commands\Generators\Views\filter.tpl.php',
'make:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
'make:model' => 'CodeIgniter\Commands\Generators\Views\model.tpl.php',
'make:seeder' => 'CodeIgniter\Commands\Generators\Views\seeder.tpl.php',
'make:validation' => 'CodeIgniter\Commands\Generators\Views\validation.tpl.php',
'session:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
];
/**
* --------------------------------------------------------------------------
* Generator Commands' Views
* --------------------------------------------------------------------------
*
* This array defines the mapping of generator commands to the view files
* they are using. If you need to customize them for your own, copy these
* view files in your own folder and indicate the location here.
*
* You will notice that the views have special placeholders enclosed in
* curly braces `{...}`. These placeholders are used internally by the
* generator commands in processing replacements, thus you are warned
* not to delete them or modify the names. If you will do so, you may
* end up disrupting the scaffolding process and throw errors.
*
* YOU HAVE BEEN WARNED!
*
* @var array<string, string>
*/
public array $views = [
'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php',
'make:config' => 'CodeIgniter\Commands\Generators\Views\config.tpl.php',
'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php',
'make:entity' => 'CodeIgniter\Commands\Generators\Views\entity.tpl.php',
'make:filter' => 'CodeIgniter\Commands\Generators\Views\filter.tpl.php',
'make:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
'make:model' => 'CodeIgniter\Commands\Generators\Views\model.tpl.php',
'make:seeder' => 'CodeIgniter\Commands\Generators\Views\seeder.tpl.php',
'make:validation' => 'CodeIgniter\Commands\Generators\Views\validation.tpl.php',
'session:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
];
}

View File

@@ -6,38 +6,37 @@ use CodeIgniter\Config\BaseConfig;
class Honeypot extends BaseConfig
{
/**
* Makes Honeypot visible or not to human
*
* @var boolean
*/
public $hidden = true;
/**
* Makes Honeypot visible or not to human
*/
public bool $hidden = true;
/**
* Honeypot Label Content
*
* @var string
*/
public $label = 'Fill This Field';
/**
* Honeypot Label Content
*/
public string $label = 'Fill This Field';
/**
* Honeypot Field Name
*
* @var string
*/
public $name = 'honeypot';
/**
* Honeypot Field Name
*/
public string $name = 'honeypot';
/**
* Honeypot HTML Template
*
* @var string
*/
public $template = '<label>{label}</label><input type="text" name="{name}" value=""/>';
/**
* Honeypot HTML Template
*/
public string $template = '<label>{label}</label><input type="text" name="{name}" value="">';
/**
* Honeypot container
*
* @var string
*/
public $container = '<div style="display:none">{template}</div>';
/**
* Honeypot container
*
* If you enabled CSP, you can remove `style="display:none"`.
*/
public string $container = '<div style="display:none">{template}</div>';
/**
* The id attribute for Honeypot container tag
*
* Used when CSP is enabled.
*/
public string $containerId = 'hpc';
}

View File

@@ -8,28 +8,24 @@ use CodeIgniter\Images\Handlers\ImageMagickHandler;
class Images extends BaseConfig
{
/**
* Default handler used if no other handler is specified.
*
* @var string
*/
public $defaultHandler = 'gd';
/**
* Default handler used if no other handler is specified.
*/
public string $defaultHandler = 'gd';
/**
* The path to the image library.
* Required for ImageMagick, GraphicsMagick, or NetPBM.
*
* @var string
*/
public $libraryPath = '/usr/local/bin/convert';
/**
* The path to the image library.
* Required for ImageMagick, GraphicsMagick, or NetPBM.
*/
public string $libraryPath = '/usr/local/bin/convert';
/**
* The available handler classes.
*
* @var array<string, string>
*/
public $handlers = [
'gd' => GDHandler::class,
'imagick' => ImageMagickHandler::class,
];
/**
* The available handler classes.
*
* @var array<string, string>
*/
public array $handlers = [
'gd' => GDHandler::class,
'imagick' => ImageMagickHandler::class,
];
}

View File

@@ -3,7 +3,7 @@
namespace Config;
use CodeIgniter\Config\BaseConfig;
use Kint\Renderer\Renderer;
use Kint\Renderer\AbstractRenderer;
/**
* --------------------------------------------------------------------------
@@ -17,45 +17,35 @@ use Kint\Renderer\Renderer;
*/
class Kint extends BaseConfig
{
/*
|--------------------------------------------------------------------------
| Global Settings
|--------------------------------------------------------------------------
*/
/*
|--------------------------------------------------------------------------
| Global Settings
|--------------------------------------------------------------------------
*/
public $plugins = null;
public $plugins;
public int $maxDepth = 6;
public bool $displayCalledFrom = true;
public bool $expanded = false;
public $maxDepth = 6;
/*
|--------------------------------------------------------------------------
| RichRenderer Settings
|--------------------------------------------------------------------------
*/
public string $richTheme = 'aante-light.css';
public bool $richFolder = false;
public int $richSort = AbstractRenderer::SORT_FULL;
public $richObjectPlugins;
public $richTabPlugins;
public $displayCalledFrom = true;
public $expanded = false;
/*
|--------------------------------------------------------------------------
| RichRenderer Settings
|--------------------------------------------------------------------------
*/
public $richTheme = 'aante-light.css';
public $richFolder = false;
public $richSort = Renderer::SORT_FULL;
public $richObjectPlugins = null;
public $richTabPlugins = null;
/*
|--------------------------------------------------------------------------
| CLI Settings
|--------------------------------------------------------------------------
*/
public $cliColors = true;
public $cliForceUTF8 = false;
public $cliDetectWidth = true;
public $cliMinWidth = 40;
/*
|--------------------------------------------------------------------------
| CLI Settings
|--------------------------------------------------------------------------
*/
public bool $cliColors = true;
public bool $cliForceUTF8 = false;
public bool $cliDetectWidth = true;
public int $cliMinWidth = 40;
}

View File

@@ -3,153 +3,148 @@
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Log\Handlers\FileHandler;
class Logger extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Error Logging Threshold
* --------------------------------------------------------------------------
*
* You can enable error logging by setting a threshold over zero. The
* threshold determines what gets logged. Any values below or equal to the
* threshold will be logged.
*
* Threshold options are:
*
* - 0 = Disables logging, Error logging TURNED OFF
* - 1 = Emergency Messages - System is unusable
* - 2 = Alert Messages - Action Must Be Taken Immediately
* - 3 = Critical Messages - Application component unavailable, unexpected exception.
* - 4 = Runtime Errors - Don't need immediate action, but should be monitored.
* - 5 = Warnings - Exceptional occurrences that are not errors.
* - 6 = Notices - Normal but significant events.
* - 7 = Info - Interesting events, like user logging in, etc.
* - 8 = Debug - Detailed debug information.
* - 9 = All Messages
*
* You can also pass an array with threshold levels to show individual error types
*
* [1, 2, 3, 8) = Emergency, Alert, Critical, and Debug messages
*
* For a live site you'll usually enable Critical or higher (3) to be logged otherwise
* your log files will fill up very fast.
*
* @var integer|array
*/
public $threshold = 0;
/**
* --------------------------------------------------------------------------
* Error Logging Threshold
* --------------------------------------------------------------------------
*
* You can enable error logging by setting a threshold over zero. The
* threshold determines what gets logged. Any values below or equal to the
* threshold will be logged.
*
* Threshold options are:
*
* - 0 = Disables logging, Error logging TURNED OFF
* - 1 = Emergency Messages - System is unusable
* - 2 = Alert Messages - Action Must Be Taken Immediately
* - 3 = Critical Messages - Application component unavailable, unexpected exception.
* - 4 = Runtime Errors - Don't need immediate action, but should be monitored.
* - 5 = Warnings - Exceptional occurrences that are not errors.
* - 6 = Notices - Normal but significant events.
* - 7 = Info - Interesting events, like user logging in, etc.
* - 8 = Debug - Detailed debug information.
* - 9 = All Messages
*
* You can also pass an array with threshold levels to show individual error types
*
* array(1, 2, 3, 8) = Emergency, Alert, Critical, and Debug messages
*
* For a live site you'll usually enable Critical or higher (3) to be logged otherwise
* your log files will fill up very fast.
*
* @var array|int
*/
public $threshold = (ENVIRONMENT === 'production') ? 4 : 9;
/**
* --------------------------------------------------------------------------
* Date Format for Logs
* --------------------------------------------------------------------------
*
* Each item that is logged has an associated date. You can use PHP date
* codes to set your own date formatting
*
* @var string
*/
public $dateFormat = 'Y-m-d H:i:s';
/**
* --------------------------------------------------------------------------
* Date Format for Logs
* --------------------------------------------------------------------------
*
* Each item that is logged has an associated date. You can use PHP date
* codes to set your own date formatting
*/
public string $dateFormat = 'Y-m-d H:i:s';
/**
* --------------------------------------------------------------------------
* Log Handlers
* --------------------------------------------------------------------------
*
* The logging system supports multiple actions to be taken when something
* is logged. This is done by allowing for multiple Handlers, special classes
* designed to write the log to their chosen destinations, whether that is
* a file on the getServer, a cloud-based service, or even taking actions such
* as emailing the dev team.
*
* Each handler is defined by the class name used for that handler, and it
* MUST implement the `CodeIgniter\Log\Handlers\HandlerInterface` interface.
*
* The value of each key is an array of configuration items that are sent
* to the constructor of each handler. The only required configuration item
* is the 'handles' element, which must be an array of integer log levels.
* This is most easily handled by using the constants defined in the
* `Psr\Log\LogLevel` class.
*
* Handlers are executed in the order defined in this array, starting with
* the handler on top and continuing down.
*
* @var array
*/
public $handlers = [
/**
* --------------------------------------------------------------------------
* Log Handlers
* --------------------------------------------------------------------------
*
* The logging system supports multiple actions to be taken when something
* is logged. This is done by allowing for multiple Handlers, special classes
* designed to write the log to their chosen destinations, whether that is
* a file on the getServer, a cloud-based service, or even taking actions such
* as emailing the dev team.
*
* Each handler is defined by the class name used for that handler, and it
* MUST implement the `CodeIgniter\Log\Handlers\HandlerInterface` interface.
*
* The value of each key is an array of configuration items that are sent
* to the constructor of each handler. The only required configuration item
* is the 'handles' element, which must be an array of integer log levels.
* This is most easily handled by using the constants defined in the
* `Psr\Log\LogLevel` class.
*
* Handlers are executed in the order defined in this array, starting with
* the handler on top and continuing down.
*/
public array $handlers = [
/*
* --------------------------------------------------------------------
* File Handler
* --------------------------------------------------------------------
*/
'CodeIgniter\Log\Handlers\FileHandler' => [
/*
* --------------------------------------------------------------------
* File Handler
* --------------------------------------------------------------------
*/
FileHandler::class => [
/*
* The log levels that this handler will handle.
*/
'handles' => [
'critical',
'alert',
'emergency',
'debug',
'error',
'info',
'notice',
'warning',
],
// The log levels that this handler will handle.
'handles' => [
'critical',
'alert',
'emergency',
'debug',
'error',
'info',
'notice',
'warning',
],
/*
* The default filename extension for log files.
* An extension of 'php' allows for protecting the log files via basic
* scripting, when they are to be stored under a publicly accessible directory.
*
* Note: Leaving it blank will default to 'log'.
*/
'fileExtension' => '',
/*
* The default filename extension for log files.
* An extension of 'php' allows for protecting the log files via basic
* scripting, when they are to be stored under a publicly accessible directory.
*
* Note: Leaving it blank will default to 'log'.
*/
'fileExtension' => '',
/*
* The file system permissions to be applied on newly created log files.
*
* IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
* integer notation (i.e. 0700, 0644, etc.)
*/
'filePermissions' => 0640,
/*
* The file system permissions to be applied on newly created log files.
*
* IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
* integer notation (i.e. 0700, 0644, etc.)
*/
'filePermissions' => 0660,
/*
* Logging Directory Path
*
* By default, logs are written to WRITEPATH . 'logs/'
* Specify a different destination here, if desired.
*/
'path' => '',
],
/*
* Logging Directory Path
*
* By default, logs are written to WRITEPATH . 'logs/'
* Specify a different destination here, if desired.
*/
'path' => '',
],
/**
* The ChromeLoggerHandler requires the use of the Chrome web browser
* and the ChromeLogger extension. Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [
// /*
// * The log levels that this handler will handle.
// */
// 'handles' => ['critical', 'alert', 'emergency', 'debug',
// 'error', 'info', 'notice', 'warning'],
// ],
/*
* The ChromeLoggerHandler requires the use of the Chrome web browser
* and the ChromeLogger extension. Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [
// /*
// * The log levels that this handler will handle.
// */
// 'handles' => ['critical', 'alert', 'emergency', 'debug',
// 'error', 'info', 'notice', 'warning'],
// ],
/**
* The ErrorlogHandler writes the logs to PHP's native `error_log()` function.
* Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ErrorlogHandler' => [
// /* The log levels this handler can handle. */
// 'handles' => ['critical', 'alert', 'emergency', 'debug', 'error', 'info', 'notice', 'warning'],
//
// /*
// * The message type where the error should go. Can be 0 or 4, or use the
// * class constants: `ErrorlogHandler::TYPE_OS` (0) or `ErrorlogHandler::TYPE_SAPI` (4)
// */
// 'messageType' => 0,
// ],
];
/*
* The ErrorlogHandler writes the logs to PHP's native `error_log()` function.
* Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ErrorlogHandler' => [
// /* The log levels this handler can handle. */
// 'handles' => ['critical', 'alert', 'emergency', 'debug', 'error', 'info', 'notice', 'warning'],
//
// /*
// * The message type where the error should go. Can be 0 or 4, or use the
// * class constants: `ErrorlogHandler::TYPE_OS` (0) or `ErrorlogHandler::TYPE_SAPI` (4)
// */
// 'messageType' => 0,
// ],
];
}

View File

@@ -6,50 +6,47 @@ use CodeIgniter\Config\BaseConfig;
class Migrations extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Enable/Disable Migrations
* --------------------------------------------------------------------------
*
* Migrations are enabled by default.
*
* You should enable migrations whenever you intend to do a schema migration
* and disable it back when you're done.
*
* @var boolean
*/
public $enabled = true;
/**
* --------------------------------------------------------------------------
* Enable/Disable Migrations
* --------------------------------------------------------------------------
*
* Migrations are enabled by default.
*
* You should enable migrations whenever you intend to do a schema migration
* and disable it back when you're done.
*/
public bool $enabled = true;
/**
* --------------------------------------------------------------------------
* Migrations Table
* --------------------------------------------------------------------------
*
* This is the name of the table that will store the current migrations state.
* When migrations runs it will store in a database table which migration
* level the system is at. It then compares the migration level in this
* table to the $config['migration_version'] if they are not the same it
* will migrate up. This must be set.
*
* @var string
*/
public $table = 'migrations';
/**
* --------------------------------------------------------------------------
* Migrations Table
* --------------------------------------------------------------------------
*
* This is the name of the table that will store the current migrations state.
* When migrations runs it will store in a database table which migration
* level the system is at. It then compares the migration level in this
* table to the $config['migration_version'] if they are not the same it
* will migrate up. This must be set.
*/
public string $table = 'migrations';
/**
* --------------------------------------------------------------------------
* Timestamp Format
* --------------------------------------------------------------------------
*
* This is the format that will be used when creating new migrations
* using the CLI command:
* > php spark migrate:create
*
* Typical formats:
* - YmdHis_
* - Y-m-d-His_
* - Y_m_d_His_
*
* @var string
*/
public $timestampFormat = 'YmdHis_';
/**
* --------------------------------------------------------------------------
* Timestamp Format
* --------------------------------------------------------------------------
*
* This is the format that will be used when creating new migrations
* using the CLI command:
* > php spark make:migration
*
* Note: if you set an unsupported format, migration runner will not find
* your migration files.
*
* Supported formats:
* - YmdHis_
* - Y-m-d-His_
* - Y_m_d_His_
*/
public string $timestampFormat = 'YmdHis_';
}

View File

File diff suppressed because it is too large Load Diff

View File

@@ -6,48 +6,71 @@ use CodeIgniter\Modules\Modules as BaseModules;
class Modules extends BaseModules
{
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all elements listed in
* $aliases below. If false, no auto-discovery will happen at all,
* giving a slight performance boost.
*
* @var boolean
*/
public $enabled = true;
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all elements listed in
* $aliases below. If false, no auto-discovery will happen at all,
* giving a slight performance boost.
*
* @var bool
*/
public $enabled = true;
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery Within Composer Packages?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all namespaces loaded
* by Composer, as well as the namespaces configured locally.
*
* @var boolean
*/
public $discoverInComposer = true;
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery Within Composer Packages?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all namespaces loaded
* by Composer, as well as the namespaces configured locally.
*
* @var bool
*/
public $discoverInComposer = true;
/**
* --------------------------------------------------------------------------
* Auto-Discovery Rules
* --------------------------------------------------------------------------
*
* Aliases list of all discovery classes that will be active and used during
* the current application request.
*
* If it is not listed, only the base application elements will be used.
*
* @var string[]
*/
public $aliases = [
'events',
'filters',
'registrars',
'routes',
'services',
];
/**
* The Composer package list for Auto-Discovery
* This setting is optional.
*
* E.g.:
* [
* 'only' => [
* // List up all packages to auto-discover
* 'codeigniter4/shield',
* ],
* ]
* or
* [
* 'exclude' => [
* // List up packages to exclude.
* 'pestphp/pest',
* ],
* ]
*
* @var array
*/
public $composerPackages = [];
/**
* --------------------------------------------------------------------------
* Auto-Discovery Rules
* --------------------------------------------------------------------------
*
* Aliases list of all discovery classes that will be active and used during
* the current application request.
*
* If it is not listed, only the base application elements will be used.
*
* @var string[]
*/
public $aliases = [
'events',
'filters',
'registrars',
'routes',
'services',
];
}

View File

@@ -11,5 +11,5 @@ use CodeIgniter\Config\BaseConfig;
*/
class OSPOS extends BaseConfig
{
public $settings = [];
}

View File

@@ -6,36 +6,34 @@ use CodeIgniter\Config\BaseConfig;
class Pager extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Templates
* --------------------------------------------------------------------------
*
* Pagination links are rendered out using views to configure their
* appearance. This array contains aliases and the view names to
* use when rendering the links.
*
* Within each view, the Pager object will be available as $pager,
* and the desired group as $pagerGroup;
*
* @var array<string, string>
*/
public $templates = [
'default_full' => 'CodeIgniter\Pager\Views\default_full',
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
'default_head' => 'CodeIgniter\Pager\Views\default_head',
];
/**
* --------------------------------------------------------------------------
* Templates
* --------------------------------------------------------------------------
*
* Pagination links are rendered out using views to configure their
* appearance. This array contains aliases and the view names to
* use when rendering the links.
*
* Within each view, the Pager object will be available as $pager,
* and the desired group as $pagerGroup;
*
* @var array<string, string>
*/
public array $templates = [
'default_full' => 'CodeIgniter\Pager\Views\default_full',
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
'default_head' => 'CodeIgniter\Pager\Views\default_head',
];
/**
* --------------------------------------------------------------------------
* Items Per Page
* --------------------------------------------------------------------------
*
* The default number of results shown in a single page.
*
* @var integer
*/
public $perPage = 20;
/**
* --------------------------------------------------------------------------
* Items Per Page
* --------------------------------------------------------------------------
*
* The default number of results shown in a single page.
*/
public int $perPage = 20;
/**
* --------------------------------------------------------------------------
@@ -60,4 +58,5 @@ class Pager extends BaseConfig
'last_tag_open' => "<li>",
'last_tagl_close' => "</li>"
];
}

View File

@@ -13,74 +13,63 @@ namespace Config;
*
* All paths are relative to the project's root folder.
*/
class Paths
{
/**
* ---------------------------------------------------------------
* SYSTEM FOLDER NAME
* ---------------------------------------------------------------
*
* This must contain the name of your "system" folder. Include
* the path if the folder is not in the same directory as this file.
*
* @var string
*/
public $systemDirectory = __DIR__ . '/../../vendor/codeigniter4/framework/system';
/**
* ---------------------------------------------------------------
* SYSTEM FOLDER NAME
* ---------------------------------------------------------------
*
* This must contain the name of your "system" folder. Include
* the path if the folder is not in the same directory as this file.
*/
public string $systemDirectory = __DIR__ . '/../../vendor/codeigniter4/framework/system';
/**
* ---------------------------------------------------------------
* APPLICATION FOLDER NAME
* ---------------------------------------------------------------
*
* If you want this front controller to use a different "app"
* folder than the default one you can set its name here. The folder
* can also be renamed or relocated anywhere on your getServer. If
* you do, use a full getServer path.
*
* @see http://codeigniter.com/user_guide/general/managing_apps.html
*
* @var string
*/
public $appDirectory = __DIR__ . '/..';
/**
* ---------------------------------------------------------------
* APPLICATION FOLDER NAME
* ---------------------------------------------------------------
*
* If you want this front controller to use a different "app"
* folder than the default one you can set its name here. The folder
* can also be renamed or relocated anywhere on your server. If
* you do, use a full server path.
*
* @see http://codeigniter.com/user_guide/general/managing_apps.html
*/
public string $appDirectory = __DIR__ . '/..';
/**
* ---------------------------------------------------------------
* WRITABLE DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "writable" directory.
* The writable directory allows you to group all directories that
* need write permission to a single place that can be tucked away
* for maximum security, keeping it out of the app and/or
* system directories.
*
* @var string
*/
public $writableDirectory = __DIR__ . '/../../writable';
/**
* ---------------------------------------------------------------
* WRITABLE DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "writable" directory.
* The writable directory allows you to group all directories that
* need write permission to a single place that can be tucked away
* for maximum security, keeping it out of the app and/or
* system directories.
*/
public string $writableDirectory = __DIR__ . '/../../writable';
/**
* ---------------------------------------------------------------
* TESTS DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "tests" directory.
*
* @var string
*/
public $testsDirectory = __DIR__ . '/../../tests';
/**
* ---------------------------------------------------------------
* TESTS DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "tests" directory.
*/
public string $testsDirectory = __DIR__ . '/../../tests';
/**
* ---------------------------------------------------------------
* VIEW DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of the directory that
* contains the view files used by your application. By
* default this is in `app/Views`. This value
* is used when no value is provided to `Services::renderer()`.
*
* @var string
*/
public $viewDirectory = __DIR__ . '/../Views';
/**
* ---------------------------------------------------------------
* VIEW DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of the directory that
* contains the view files used by your application. By
* default this is in `app/Views`. This value
* is used when no value is provided to `Services::renderer()`.
*/
public string $viewDirectory = __DIR__ . '/../Views';
}

28
app/Config/Publisher.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
namespace Config;
use CodeIgniter\Config\Publisher as BasePublisher;
/**
* Publisher Configuration
*
* Defines basic security restrictions for the Publisher class
* to prevent abuse by injecting malicious files into a project.
*/
class Publisher extends BasePublisher
{
/**
* A list of allowed destinations with a (pseudo-)regex
* of allowed files for each destination.
* Attempts to publish to directories not in this list will
* result in a PublisherException. Files that do no fit the
* pattern will cause copy/merge to fail.
*
* @var array<string,string>
*/
public $restrictions = [
ROOTPATH => '*',
FCPATH => '#\.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
];
}

View File

@@ -5,13 +5,6 @@ namespace Config;
// Create a new instance of our RouteCollection class.
$routes = Services::routes();
// Load the system's routing file first, so that the app and ENVIRONMENT
// can override as needed.
if (file_exists(SYSTEMPATH . 'Config/Routes.php'))
{
require SYSTEMPATH . 'Config/Routes.php';
}
/*
* --------------------------------------------------------------------
* Router Setup
@@ -22,6 +15,10 @@ $routes->setDefaultController('Login');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override();
// The Auto Routing (Legacy) is very dangerous. It is easy to create vulnerable apps
// where controller filters or CSRF protection are bypassed.
// If you don't want to define all routes, please use the Auto Routing (Improved).
// Set `$autoRoutesImproved` to true in `app/Config/Feature.php` and set the following to true.
$routes->setAutoRoute(true);
/*
@@ -32,10 +29,13 @@ $routes->setAutoRoute(true);
// We get a performance increase by specifying the default
// route since we don't have to scan directories.
$routes->get('/', 'Login::index');
$routes->add('no_access/([^/]+)', 'No_access::index/$1');
$routes->add('no_access/([^/]+)/([^/]+)', 'No_access::index/$1/$2');
$routes->get('/', 'Login::index');
$routes->get('login', 'Login::index');
$routes->post('login', 'Login::index');
$routes->add('no_access/([^/]+)', 'No_access::getIndex/$1');
$routes->add('no_access/([^/]+)/([^/]+)', 'No_access::getIndex/$1/$2');
$routes->add('sales/index/([^/]+)', 'Sales::manage/$1');
$routes->add('sales/index/([^/]+)/([^/]+)', 'Sales::manage/$1/$2');
@@ -79,7 +79,6 @@ $routes->add('reports/specific_supplier', 'Reports::specific_supplier_input');
* You will have access to the $routes object within that file without
* needing to reload it.
*/
if (file_exists(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php'))
{
require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
if (is_file(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
}

View File

@@ -6,90 +6,96 @@ use CodeIgniter\Config\BaseConfig;
class Security extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CSRF Token Name
* --------------------------------------------------------------------------
*
* Token name for Cross Site Request Forgery protection cookie.
*
* @var string
*/
public $tokenName = 'csrf_ospos_v4';
/**
* --------------------------------------------------------------------------
* CSRF Protection Method
* --------------------------------------------------------------------------
*
* Protection Method for Cross Site Request Forgery protection.
*
* @var string 'cookie' or 'session'
*/
public string $csrfProtection = 'cookie';
/**
* --------------------------------------------------------------------------
* CSRF Header Name
* --------------------------------------------------------------------------
*
* Token name for Cross Site Request Forgery protection cookie.
*
* @var string
*/
public $headerName = 'X-CSRF-TOKEN';
/**
* --------------------------------------------------------------------------
* CSRF Token Randomization
* --------------------------------------------------------------------------
*
* Randomize the CSRF Token for added security.
*/
public bool $tokenRandomize = false;
/**
* --------------------------------------------------------------------------
* CSRF Cookie Name
* --------------------------------------------------------------------------
*
* Cookie name for Cross Site Request Forgery protection cookie.
*
* @var string
*/
public $cookieName = 'csrf_cookie_ospos_v4';
/**
* --------------------------------------------------------------------------
* CSRF Token Name
* --------------------------------------------------------------------------
*
* Token name for Cross Site Request Forgery protection.
*/
public string $tokenName = 'csrf_ospos_v4';
/**
* --------------------------------------------------------------------------
* CSRF Expires
* --------------------------------------------------------------------------
*
* Expiration time for Cross Site Request Forgery protection cookie.
*
* Defaults to two hours (in seconds).
*
* @var integer
*/
public $expires = 7200;
/**
* --------------------------------------------------------------------------
* CSRF Header Name
* --------------------------------------------------------------------------
*
* Header name for Cross Site Request Forgery protection.
*/
public string $headerName = 'X-CSRF-TOKEN';
/**
* --------------------------------------------------------------------------
* CSRF Regenerate
* --------------------------------------------------------------------------
*
* Regenerate CSRF Token on every request.
*
* @var boolean
*/
public $regenerate = true;
/**
* --------------------------------------------------------------------------
* CSRF Cookie Name
* --------------------------------------------------------------------------
*
* Cookie name for Cross Site Request Forgery protection.
*/
public string $cookieName = 'csrf_cookie_ospos_v4';
/**
* --------------------------------------------------------------------------
* CSRF Redirect
* --------------------------------------------------------------------------
*
* Redirect to previous page with error on failure.
*
* @var boolean
*/
public $redirect = true;
/**
* --------------------------------------------------------------------------
* CSRF Expires
* --------------------------------------------------------------------------
*
* Expiration time for Cross Site Request Forgery protection cookie.
*
* Defaults to two hours (in seconds).
*/
public int $expires = 7200;
/**
* --------------------------------------------------------------------------
* CSRF SameSite
* --------------------------------------------------------------------------
*
* Setting for CSRF SameSite cookie token.
*
* Allowed values are: None - Lax - Strict - ''.
*
* Defaults to `Lax` as recommended in this link:
*
* @see https://portswigger.net/web-security/csrf/samesite-cookies
*
* @var string
*
* @deprecated
*/
public $samesite = 'Lax';
/**
* --------------------------------------------------------------------------
* CSRF Regenerate
* --------------------------------------------------------------------------
*
* Regenerate CSRF Token on every submission.
*/
public bool $regenerate = true;
/**
* --------------------------------------------------------------------------
* CSRF Redirect
* --------------------------------------------------------------------------
*
* Redirect to previous page with error on failure.
*/
public bool $redirect = false;
/**
* --------------------------------------------------------------------------
* CSRF SameSite
* --------------------------------------------------------------------------
*
* Setting for CSRF SameSite cookie token.
*
* Allowed values are: None - Lax - Strict - ''.
*
* Defaults to `Lax` as recommended in this link:
*
* @see https://portswigger.net/web-security/csrf/samesite-cookies
*
* @deprecated `Config\Cookie` $samesite property is used.
*/
public string $samesite = 'Lax';
}

View File

@@ -19,13 +19,14 @@ use CodeIgniter\Config\BaseService;
*/
class Services extends BaseService
{
// public static function example($getShared = true)
// {
// if ($getShared)
// {
// return static::getSharedInstance('example');
// }
//
// return new \CodeIgniter\Example();
// }
/*
* public static function example($getShared = true)
* {
* if ($getShared) {
* return static::getSharedInstance('example');
* }
*
* return new \CodeIgniter\Example();
* }
*/
}

102
app/Config/Session.php Normal file
View File

@@ -0,0 +1,102 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Session\Handlers\BaseHandler;
use CodeIgniter\Session\Handlers\DatabaseHandler;
class Session extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Session Driver
* --------------------------------------------------------------------------
*
* The session storage driver to use:
* - `CodeIgniter\Session\Handlers\FileHandler`
* - `CodeIgniter\Session\Handlers\DatabaseHandler`
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
* - `CodeIgniter\Session\Handlers\RedisHandler`
*
* @phpstan-var class-string<BaseHandler>
*/
public string $driver = DatabaseHandler::class;
/**
* --------------------------------------------------------------------------
* Session Cookie Name
* --------------------------------------------------------------------------
*
* The session cookie name, must contain only [0-9a-z_-] characters
*/
public string $cookieName = 'ospos_session';
/**
* --------------------------------------------------------------------------
* Session Expiration
* --------------------------------------------------------------------------
*
* The number of SECONDS you want the session to last.
* Setting to 0 (zero) means expire when the browser is closed.
*/
public int $expiration = 7200;
/**
* --------------------------------------------------------------------------
* Session Save Path
* --------------------------------------------------------------------------
*
* The location to save sessions to and is driver dependent.
*
* For the 'files' driver, it's a path to a writable directory.
* WARNING: Only absolute paths are supported!
*
* For the 'database' driver, it's a table name.
* Please read up the manual for the format with other session drivers.
*
* IMPORTANT: You are REQUIRED to set a valid save path!
*/
public string $savePath = 'sessions';
/**
* --------------------------------------------------------------------------
* Session Match IP
* --------------------------------------------------------------------------
*
* Whether to match the user's IP address when reading the session data.
*
* WARNING: If you're using the database driver, don't forget to update
* your session table's PRIMARY KEY when changing this setting.
*/
public bool $matchIP = true;
/**
* --------------------------------------------------------------------------
* Session Time to Update
* --------------------------------------------------------------------------
*
* How many seconds between CI regenerating the session ID.
*/
public int $timeToUpdate = 300;
/**
* --------------------------------------------------------------------------
* Session Regenerate Destroy
* --------------------------------------------------------------------------
*
* Whether to destroy session data associated with the old session ID
* when auto-regenerating the session ID. When set to FALSE, the data
* will be later deleted by the garbage collector.
*/
public bool $regenerateDestroy = false;
/**
* --------------------------------------------------------------------------
* Session Database Group
* --------------------------------------------------------------------------
*
* DB Group for the database session.
*/
public ?string $DBGroup = null;
}

View File

@@ -1,68 +0,0 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Smileys extends BaseConfig
{
/*
| -------------------------------------------------------------------
| SMILEYS
| -------------------------------------------------------------------
| This file contains an array of smileys for use with the emoticon helper.
| Individual images can be used to replace multiple smileys. For example:
| :-) and :) use the same image replacement.
|
| Please see user guide for more info:
| https://codeigniter.com/user_guide/helpers/smiley_helper.html
|
*/
public $smileys = [
// smiley image name width height alt
':-)' => ['grin.gif', '19', '19', 'grin'],
':lol:' => ['lol.gif', '19', '19', 'LOL'],
':cheese:' => ['cheese.gif', '19', '19', 'cheese'],
':)' => ['smile.gif', '19', '19', 'smile'],
';-)' => ['wink.gif', '19', '19', 'wink'],
';)' => ['wink.gif', '19', '19', 'wink'],
':smirk:' => ['smirk.gif', '19', '19', 'smirk'],
':roll:' => ['rolleyes.gif', '19', '19', 'rolleyes'],
':-S' => ['confused.gif', '19', '19', 'confused'],
':wow:' => ['surprise.gif', '19', '19', 'surprised'],
':bug:' => ['bigsurprise.gif', '19', '19', 'big surprise'],
':-P' => ['tongue_laugh.gif', '19', '19', 'tongue laugh'],
'%-P' => ['tongue_rolleye.gif', '19', '19', 'tongue rolleye'],
';-P' => ['tongue_wink.gif', '19', '19', 'tongue wink'],
':P' => ['raspberry.gif', '19', '19', 'raspberry'],
':blank:' => ['blank.gif', '19', '19', 'blank stare'],
':long:' => ['longface.gif', '19', '19', 'long face'],
':ohh:' => ['ohh.gif', '19', '19', 'ohh'],
':grrr:' => ['grrr.gif', '19', '19', 'grrr'],
':gulp:' => ['gulp.gif', '19', '19', 'gulp'],
'8-/' => ['ohoh.gif', '19', '19', 'oh oh'],
':down:' => ['downer.gif', '19', '19', 'downer'],
':red:' => ['embarrassed.gif', '19', '19', 'red face'],
':sick:' => ['sick.gif', '19', '19', 'sick'],
':shut:' => ['shuteye.gif', '19', '19', 'shut eye'],
':-/' => ['hmm.gif', '19', '19', 'hmmm'],
'>:(' => ['mad.gif', '19', '19', 'mad'],
':mad:' => ['mad.gif', '19', '19', 'mad'],
'>:-(' => ['angry.gif', '19', '19', 'angry'],
':angry:' => ['angry.gif', '19', '19', 'angry'],
':zip:' => ['zip.gif', '19', '19', 'zipper'],
':kiss:' => ['kiss.gif', '19', '19', 'kiss'],
':ahhh:' => ['shock.gif', '19', '19', 'shock'],
':coolsmile:' => ['shade_smile.gif', '19', '19', 'cool smile'],
':coolsmirk:' => ['shade_smirk.gif', '19', '19', 'cool smirk'],
':coolgrin:' => ['shade_grin.gif', '19', '19', 'cool grin'],
':coolhmm:' => ['shade_hmm.gif', '19', '19', 'cool hmm'],
':coolmad:' => ['shade_mad.gif', '19', '19', 'cool mad'],
':coolcheese:' => ['shade_cheese.gif', '19', '19', 'cool cheese'],
':vampire:' => ['vampire.gif', '19', '19', 'vampire'],
':snake:' => ['snake.gif', '19', '19', 'snake'],
':exclaim:' => ['exclaim.gif', '19', '19', 'exclaim'],
':question:' => ['question.gif', '19', '19', 'question']
];
}

View File

@@ -23,65 +23,69 @@ use CodeIgniter\Debug\Toolbar\Collectors\Views;
*/
class Toolbar extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Toolbar Collectors
* --------------------------------------------------------------------------
*
* List of toolbar collectors that will be called when Debug Toolbar
* fires up and collects data from.
*
* @var string[]
*/
public $collectors = [
Timers::class,
Database::class,
Logs::class,
Views::class,
// \CodeIgniter\Debug\Toolbar\Collectors\Cache::class,
Files::class,
Routes::class,
Events::class,
];
/**
* --------------------------------------------------------------------------
* Toolbar Collectors
* --------------------------------------------------------------------------
*
* List of toolbar collectors that will be called when Debug Toolbar
* fires up and collects data from.
*
* @var string[]
*/
public array $collectors = [
Timers::class,
Database::class,
Logs::class,
Views::class,
// \CodeIgniter\Debug\Toolbar\Collectors\Cache::class,
Files::class,
Routes::class,
Events::class,
];
/**
* --------------------------------------------------------------------------
* Max History
* --------------------------------------------------------------------------
*
* `$maxHistory` sets a limit on the number of past requests that are stored,
* helping to conserve file space used to store them. You can set it to
* 0 (zero) to not have any history stored, or -1 for unlimited history.
*
* @var integer
*/
public $maxHistory = 20;
/**
* --------------------------------------------------------------------------
* Collect Var Data
* --------------------------------------------------------------------------
*
* If set to false var data from the views will not be colleted. Useful to
* avoid high memory usage when there are lots of data passed to the view.
*/
public bool $collectVarData = true;
/**
* --------------------------------------------------------------------------
* Toolbar Views Path
* --------------------------------------------------------------------------
*
* The full path to the the views that are used by the toolbar.
* This MUST have a trailing slash.
*
* @var string
*/
public $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/';
/**
* --------------------------------------------------------------------------
* Max History
* --------------------------------------------------------------------------
*
* `$maxHistory` sets a limit on the number of past requests that are stored,
* helping to conserve file space used to store them. You can set it to
* 0 (zero) to not have any history stored, or -1 for unlimited history.
*/
public int $maxHistory = 20;
/**
* --------------------------------------------------------------------------
* Max Queries
* --------------------------------------------------------------------------
*
* If the Database Collector is enabled, it will log every query that the
* the system generates so they can be displayed on the toolbar's timeline
* and in the query log. This can lead to memory issues in some instances
* with hundreds of queries.
*
* `$maxQueries` defines the maximum amount of queries that will be stored.
*
* @var integer
*/
public $maxQueries = 100;
/**
* --------------------------------------------------------------------------
* Toolbar Views Path
* --------------------------------------------------------------------------
*
* The full path to the the views that are used by the toolbar.
* This MUST have a trailing slash.
*/
public string $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/';
/**
* --------------------------------------------------------------------------
* Max Queries
* --------------------------------------------------------------------------
*
* If the Database Collector is enabled, it will log every query that the
* the system generates so they can be displayed on the toolbar's timeline
* and in the query log. This can lead to memory issues in some instances
* with hundreds of queries.
*
* `$maxQueries` defines the maximum amount of queries that will be stored.
*/
public int $maxQueries = 100;
}

View File

@@ -16,237 +16,237 @@ use CodeIgniter\Config\BaseConfig;
*/
class UserAgents extends BaseConfig
{
/**
* -------------------------------------------------------------------
* OS Platforms
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public $platforms = [
'windows nt 10.0' => 'Windows 10',
'windows nt 6.3' => 'Windows 8.1',
'windows nt 6.2' => 'Windows 8',
'windows nt 6.1' => 'Windows 7',
'windows nt 6.0' => 'Windows Vista',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.1' => 'Windows XP',
'windows nt 5.0' => 'Windows 2000',
'windows nt 4.0' => 'Windows NT 4.0',
'winnt4.0' => 'Windows NT 4.0',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows phone' => 'Windows Phone',
'windows' => 'Unknown Windows OS',
'android' => 'Android',
'blackberry' => 'BlackBerry',
'iphone' => 'iOS',
'ipad' => 'iOS',
'ipod' => 'iOS',
'os x' => 'Mac OS X',
'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
'linux' => 'Linux',
'debian' => 'Debian',
'sunos' => 'Sun Solaris',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'gnu' => 'GNU/Linux',
'unix' => 'Unknown Unix OS',
'symbian' => 'Symbian OS',
];
/**
* -------------------------------------------------------------------
* OS Platforms
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $platforms = [
'windows nt 10.0' => 'Windows 10',
'windows nt 6.3' => 'Windows 8.1',
'windows nt 6.2' => 'Windows 8',
'windows nt 6.1' => 'Windows 7',
'windows nt 6.0' => 'Windows Vista',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.1' => 'Windows XP',
'windows nt 5.0' => 'Windows 2000',
'windows nt 4.0' => 'Windows NT 4.0',
'winnt4.0' => 'Windows NT 4.0',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows phone' => 'Windows Phone',
'windows' => 'Unknown Windows OS',
'android' => 'Android',
'blackberry' => 'BlackBerry',
'iphone' => 'iOS',
'ipad' => 'iOS',
'ipod' => 'iOS',
'os x' => 'Mac OS X',
'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
'linux' => 'Linux',
'debian' => 'Debian',
'sunos' => 'Sun Solaris',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'gnu' => 'GNU/Linux',
'unix' => 'Unknown Unix OS',
'symbian' => 'Symbian OS',
];
/**
* -------------------------------------------------------------------
* Browsers
* -------------------------------------------------------------------
*
* The order of this array should NOT be changed. Many browsers return
* multiple browser types so we want to identify the subtype first.
*
* @var array<string, string>
*/
public $browsers = [
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => 'Spartan',
'Edg' => 'Edge',
'Chrome' => 'Chrome',
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
'Opera.*?Version' => 'Opera',
'Opera' => 'Opera',
'MSIE' => 'Internet Explorer',
'Internet Explorer' => 'Internet Explorer',
'Trident.* rv' => 'Internet Explorer',
'Shiira' => 'Shiira',
'Firefox' => 'Firefox',
'Chimera' => 'Chimera',
'Phoenix' => 'Phoenix',
'Firebird' => 'Firebird',
'Camino' => 'Camino',
'Netscape' => 'Netscape',
'OmniWeb' => 'OmniWeb',
'Safari' => 'Safari',
'Mozilla' => 'Mozilla',
'Konqueror' => 'Konqueror',
'icab' => 'iCab',
'Lynx' => 'Lynx',
'Links' => 'Links',
'hotjava' => 'HotJava',
'amaya' => 'Amaya',
'IBrowse' => 'IBrowse',
'Maxthon' => 'Maxthon',
'Ubuntu' => 'Ubuntu Web Browser',
'Vivaldi' => 'Vivaldi',
];
/**
* -------------------------------------------------------------------
* Browsers
* -------------------------------------------------------------------
*
* The order of this array should NOT be changed. Many browsers return
* multiple browser types so we want to identify the subtype first.
*
* @var array<string, string>
*/
public array $browsers = [
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => 'Spartan',
'Edg' => 'Edge',
'Chrome' => 'Chrome',
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
'Opera.*?Version' => 'Opera',
'Opera' => 'Opera',
'MSIE' => 'Internet Explorer',
'Internet Explorer' => 'Internet Explorer',
'Trident.* rv' => 'Internet Explorer',
'Shiira' => 'Shiira',
'Firefox' => 'Firefox',
'Chimera' => 'Chimera',
'Phoenix' => 'Phoenix',
'Firebird' => 'Firebird',
'Camino' => 'Camino',
'Netscape' => 'Netscape',
'OmniWeb' => 'OmniWeb',
'Safari' => 'Safari',
'Mozilla' => 'Mozilla',
'Konqueror' => 'Konqueror',
'icab' => 'iCab',
'Lynx' => 'Lynx',
'Links' => 'Links',
'hotjava' => 'HotJava',
'amaya' => 'Amaya',
'IBrowse' => 'IBrowse',
'Maxthon' => 'Maxthon',
'Ubuntu' => 'Ubuntu Web Browser',
'Vivaldi' => 'Vivaldi',
];
/**
* -------------------------------------------------------------------
* Mobiles
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public $mobiles = [
// legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave',
// 'opera mini' => 'Opera Mini',
// 'operamini' => 'Opera Mini',
// 'elaine' => 'Palm',
'palmsource' => 'Palm',
// 'digital paths' => 'Palm',
// 'avantgo' => 'Avantgo',
// 'xiino' => 'Xiino',
'palmscape' => 'Palmscape',
// 'nokia' => 'Nokia',
// 'ericsson' => 'Ericsson',
// 'blackberry' => 'BlackBerry',
// 'motorola' => 'Motorola'
/**
* -------------------------------------------------------------------
* Mobiles
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $mobiles = [
// legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave',
// 'opera mini' => 'Opera Mini',
// 'operamini' => 'Opera Mini',
// 'elaine' => 'Palm',
'palmsource' => 'Palm',
// 'digital paths' => 'Palm',
// 'avantgo' => 'Avantgo',
// 'xiino' => 'Xiino',
'palmscape' => 'Palmscape',
// 'nokia' => 'Nokia',
// 'ericsson' => 'Ericsson',
// 'blackberry' => 'BlackBerry',
// 'motorola' => 'Motorola'
// Phones and Manufacturers
'motorola' => 'Motorola',
'nokia' => 'Nokia',
'palm' => 'Palm',
'iphone' => 'Apple iPhone',
'ipad' => 'iPad',
'ipod' => 'Apple iPod Touch',
'sony' => 'Sony Ericsson',
'ericsson' => 'Sony Ericsson',
'blackberry' => 'BlackBerry',
'cocoon' => 'O2 Cocoon',
'blazer' => 'Treo',
'lg' => 'LG',
'amoi' => 'Amoi',
'xda' => 'XDA',
'mda' => 'MDA',
'vario' => 'Vario',
'htc' => 'HTC',
'samsung' => 'Samsung',
'sharp' => 'Sharp',
'sie-' => 'Siemens',
'alcatel' => 'Alcatel',
'benq' => 'BenQ',
'ipaq' => 'HP iPaq',
'mot-' => 'Motorola',
'playstation portable' => 'PlayStation Portable',
'playstation 3' => 'PlayStation 3',
'playstation vita' => 'PlayStation Vita',
'hiptop' => 'Danger Hiptop',
'nec-' => 'NEC',
'panasonic' => 'Panasonic',
'philips' => 'Philips',
'sagem' => 'Sagem',
'sanyo' => 'Sanyo',
'spv' => 'SPV',
'zte' => 'ZTE',
'sendo' => 'Sendo',
'nintendo dsi' => 'Nintendo DSi',
'nintendo ds' => 'Nintendo DS',
'nintendo 3ds' => 'Nintendo 3DS',
'wii' => 'Nintendo Wii',
'open web' => 'Open Web',
'openweb' => 'OpenWeb',
// Phones and Manufacturers
'motorola' => 'Motorola',
'nokia' => 'Nokia',
'palm' => 'Palm',
'iphone' => 'Apple iPhone',
'ipad' => 'iPad',
'ipod' => 'Apple iPod Touch',
'sony' => 'Sony Ericsson',
'ericsson' => 'Sony Ericsson',
'blackberry' => 'BlackBerry',
'cocoon' => 'O2 Cocoon',
'blazer' => 'Treo',
'lg' => 'LG',
'amoi' => 'Amoi',
'xda' => 'XDA',
'mda' => 'MDA',
'vario' => 'Vario',
'htc' => 'HTC',
'samsung' => 'Samsung',
'sharp' => 'Sharp',
'sie-' => 'Siemens',
'alcatel' => 'Alcatel',
'benq' => 'BenQ',
'ipaq' => 'HP iPaq',
'mot-' => 'Motorola',
'playstation portable' => 'PlayStation Portable',
'playstation 3' => 'PlayStation 3',
'playstation vita' => 'PlayStation Vita',
'hiptop' => 'Danger Hiptop',
'nec-' => 'NEC',
'panasonic' => 'Panasonic',
'philips' => 'Philips',
'sagem' => 'Sagem',
'sanyo' => 'Sanyo',
'spv' => 'SPV',
'zte' => 'ZTE',
'sendo' => 'Sendo',
'nintendo dsi' => 'Nintendo DSi',
'nintendo ds' => 'Nintendo DS',
'nintendo 3ds' => 'Nintendo 3DS',
'wii' => 'Nintendo Wii',
'open web' => 'Open Web',
'openweb' => 'OpenWeb',
// Operating Systems
'android' => 'Android',
'symbian' => 'Symbian',
'SymbianOS' => 'SymbianOS',
'elaine' => 'Palm',
'series60' => 'Symbian S60',
'windows ce' => 'Windows CE',
// Operating Systems
'android' => 'Android',
'symbian' => 'Symbian',
'SymbianOS' => 'SymbianOS',
'elaine' => 'Palm',
'series60' => 'Symbian S60',
'windows ce' => 'Windows CE',
// Browsers
'obigo' => 'Obigo',
'netfront' => 'Netfront Browser',
'openwave' => 'Openwave Browser',
'mobilexplorer' => 'Mobile Explorer',
'operamini' => 'Opera Mini',
'opera mini' => 'Opera Mini',
'opera mobi' => 'Opera Mobile',
'fennec' => 'Firefox Mobile',
// Browsers
'obigo' => 'Obigo',
'netfront' => 'Netfront Browser',
'openwave' => 'Openwave Browser',
'mobilexplorer' => 'Mobile Explorer',
'operamini' => 'Opera Mini',
'opera mini' => 'Opera Mini',
'opera mobi' => 'Opera Mobile',
'fennec' => 'Firefox Mobile',
// Other
'digital paths' => 'Digital Paths',
'avantgo' => 'AvantGo',
'xiino' => 'Xiino',
'novarra' => 'Novarra Transcoder',
'vodafone' => 'Vodafone',
'docomo' => 'NTT DoCoMo',
'o2' => 'O2',
// Other
'digital paths' => 'Digital Paths',
'avantgo' => 'AvantGo',
'xiino' => 'Xiino',
'novarra' => 'Novarra Transcoder',
'vodafone' => 'Vodafone',
'docomo' => 'NTT DoCoMo',
'o2' => 'O2',
// Fallback
'mobile' => 'Generic Mobile',
'wireless' => 'Generic Mobile',
'j2me' => 'Generic Mobile',
'midp' => 'Generic Mobile',
'cldc' => 'Generic Mobile',
'up.link' => 'Generic Mobile',
'up.browser' => 'Generic Mobile',
'smartphone' => 'Generic Mobile',
'cellphone' => 'Generic Mobile',
];
// Fallback
'mobile' => 'Generic Mobile',
'wireless' => 'Generic Mobile',
'j2me' => 'Generic Mobile',
'midp' => 'Generic Mobile',
'cldc' => 'Generic Mobile',
'up.link' => 'Generic Mobile',
'up.browser' => 'Generic Mobile',
'smartphone' => 'Generic Mobile',
'cellphone' => 'Generic Mobile',
];
/**
* -------------------------------------------------------------------
* Robots
* -------------------------------------------------------------------
*
* There are hundred of bots but these are the most common.
*
* @var array<string, string>
*/
public $robots = [
'googlebot' => 'Googlebot',
'msnbot' => 'MSNBot',
'baiduspider' => 'Baiduspider',
'bingbot' => 'Bing',
'slurp' => 'Inktomi Slurp',
'yahoo' => 'Yahoo',
'ask jeeves' => 'Ask Jeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos',
'yandex' => 'YandexBot',
'mediapartners-google' => 'MediaPartners Google',
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
'adsbot-google' => 'AdsBot Google',
'feedfetcher-google' => 'Feedfetcher Google',
'curious george' => 'Curious George',
'ia_archiver' => 'Alexa Crawler',
'MJ12bot' => 'Majestic-12',
'Uptimebot' => 'Uptimebot',
];
/**
* -------------------------------------------------------------------
* Robots
* -------------------------------------------------------------------
*
* There are hundred of bots but these are the most common.
*
* @var array<string, string>
*/
public array $robots = [
'googlebot' => 'Googlebot',
'msnbot' => 'MSNBot',
'baiduspider' => 'Baiduspider',
'bingbot' => 'Bing',
'slurp' => 'Inktomi Slurp',
'yahoo' => 'Yahoo',
'ask jeeves' => 'Ask Jeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos',
'yandex' => 'YandexBot',
'mediapartners-google' => 'MediaPartners Google',
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
'adsbot-google' => 'AdsBot Google',
'feedfetcher-google' => 'Feedfetcher Google',
'curious george' => 'Curious George',
'ia_archiver' => 'Alexa Crawler',
'MJ12bot' => 'Majestic-12',
'Uptimebot' => 'Uptimebot',
];
}

View File

@@ -2,45 +2,45 @@
namespace Config;
use CodeIgniter\Validation\CreditCardRules;
use CodeIgniter\Validation\FileRules;
use CodeIgniter\Validation\FormatRules;
use CodeIgniter\Validation\Rules;
use app\Libraries\MY_Validation;
use App\Config\Validation\OSPOSRules;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Validation\StrictRules\CreditCardRules;
use CodeIgniter\Validation\StrictRules\FileRules;
use CodeIgniter\Validation\StrictRules\FormatRules;
use CodeIgniter\Validation\StrictRules\Rules;
class Validation
class Validation extends BaseConfig
{
//--------------------------------------------------------------------
// Setup
//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Setup
// --------------------------------------------------------------------
/**
* Stores the classes that contain the
* rules that are available.
*
* @var string[]
*/
public $ruleSets = [
Rules::class,
FormatRules::class,
FileRules::class,
CreditCardRules::class,
MY_Validation::class
/**
* Stores the classes that contain the
* rules that are available.
*
* @var string[]
*/
public array $ruleSets = [
Rules::class,
FormatRules::class,
FileRules::class,
CreditCardRules::class,
OSPOSRules::class
];
/**
* Specifies the views that are used to display the
* errors.
*
* @var array<string, string>
*/
public $templates = [
'error' => 'app\Views\errors\error.php',
'list' => 'CodeIgniter\Validation\Views\list',
'single' => 'CodeIgniter\Validation\Views\single',
];
/**
* Specifies the views that are used to display the
* errors.
*
* @var array<string, string>
*/
public array $templates = [
'list' => 'CodeIgniter\Validation\Views\list',
'single' => 'CodeIgniter\Validation\Views\single',
];
//--------------------------------------------------------------------
// Rules
//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Rules
// --------------------------------------------------------------------
}

View File

@@ -0,0 +1,131 @@
<?php
namespace App\Config\Validation;
use App\Models\Employee;
use CodeIgniter\HTTP\IncomingRequest;
use Config\Services;
/**
* @property employee employee
* @property IncomingRequest request
*/
class OSPOSRules
{
/**
* Validates the username and password sent to the login view. User is logged in on successful validation.
*
* @param string $username Username to check against.
* @param string $fields Comma separated string of the fields for validation.
* @param array $data Data sent to the view.
* @param string|null $error The error sent back to the validation handler on failure.
* @return bool True if validation passes or false if there are errors.
*/
public function login_check(string $username, string $fields , array $data, ?string &$error = null): bool
{
$this->employee = model('Employee');
$this->request = Services::request();
//Installation Check
if(!$this->installation_check())
{
$error = lang('Login.invalid_installation');
return false;
}
//Username and Password Check
$password = $data['password'];
if(!$this->employee->login($username, $password))
{
$error = lang('Login.invalid_username_and_password');
return false;
}
//GCaptcha Check
$gcaptcha_enabled = array_key_exists('gcaptcha_enable', config('OSPOS')->settings)
? config('OSPOS')->settings['gcaptcha_enable']
: false;
if($gcaptcha_enabled)
{
$g_recaptcha_response = $this->request->getPost('g-recaptcha-response');
if(!$this->gcaptcha_check($g_recaptcha_response))
{
$error = lang('Login.invalid_gcaptcha');
return false;
}
}
return true;
}
/**
* Checks to see if GCaptcha verification was successful.
*
* @param $response
* @return bool true on successful GCaptcha verification or false if GCaptcha failed.
*/
private function gcaptcha_check($response): bool
{
if(!empty($response))
{
$check = [
'secret' => config('OSPOS')->settings['gcaptcha_secret_key'],
'response' => $response,
'remoteip' => $this->request->getIPAddress()
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify");
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($check));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
$status = json_decode($result, TRUE);
if(!empty($status['success']))
{
return true;
}
}
return false;
}
/**
* Checks to make sure dependency PHP extensions are installed
*
* @return bool
*/
private function installation_check(): bool
{
$installed_extensions = implode(', ', get_loaded_extensions());
$required_extensions = ['bcmath', 'intl', 'gd', 'openssl', 'mbstring', 'curl'];
$pattern = '/';
foreach($required_extensions as $extension)
{
$pattern .= '(?=.*\b' . preg_quote($extension, '/') . '\b)';
}
$pattern .= '/i';
$is_installed = preg_match($pattern, $installed_extensions);
if(!$is_installed)
{
log_message('error', '[ERROR] Check your php.ini.');
log_message('error',"PHP installed extensions: $installed_extensions");
log_message('error','PHP required extensions: ' . implode(', ', $required_extensions));
}
return $is_installed;
}
}

View File

@@ -3,42 +3,54 @@
namespace Config;
use CodeIgniter\Config\View as BaseView;
use CodeIgniter\View\ViewDecoratorInterface;
class View extends BaseView
{
/**
* When false, the view method will clear the data between each
* call. This keeps your data safe and ensures there is no accidental
* leaking between calls, so you would need to explicitly pass the data
* to each view. You might prefer to have the data stick around between
* calls so that it is available to all views. If that is the case,
* set $saveData to true.
*
* @var boolean
*/
public $saveData = true;
/**
* When false, the view method will clear the data between each
* call. This keeps your data safe and ensures there is no accidental
* leaking between calls, so you would need to explicitly pass the data
* to each view. You might prefer to have the data stick around between
* calls so that it is available to all views. If that is the case,
* set $saveData to true.
*
* @var bool
*/
public $saveData = true;
/**
* Parser Filters map a filter name with any PHP callable. When the
* Parser prepares a variable for display, it will chain it
* through the filters in the order defined, inserting any parameters.
* To prevent potential abuse, all filters MUST be defined here
* in order for them to be available for use within the Parser.
*
* Examples:
* { title|esc(js) }
* { created_on|date(Y-m-d)|esc(attr) }
*
* @var array
*/
public $filters = [];
/**
* Parser Filters map a filter name with any PHP callable. When the
* Parser prepares a variable for display, it will chain it
* through the filters in the order defined, inserting any parameters.
* To prevent potential abuse, all filters MUST be defined here
* in order for them to be available for use within the Parser.
*
* Examples:
* { title|esc(js) }
* { created_on|date(Y-m-d)|esc(attr) }
*
* @var array
*/
public $filters = [];
/**
* Parser Plugins provide a way to extend the functionality provided
* by the core Parser by creating aliases that will be replaced with
* any callable. Can be single or tag pair.
*
* @var array
*/
public $plugins = [];
/**
* Parser Plugins provide a way to extend the functionality provided
* by the core Parser by creating aliases that will be replaced with
* any callable. Can be single or tag pair.
*
* @var array
*/
public $plugins = [];
/**
* View Decorators are class methods that will be run in sequence to
* have a chance to alter the generated output just prior to caching
* the results.
*
* All classes must implement CodeIgniter\View\ViewDecoratorInterface
*
* @var class-string<ViewDecoratorInterface>[]
*/
public array $decorators = [];
}

View File

@@ -1,11 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -1,12 +0,0 @@
<?php
/*
| -------------------------------------------------------------------------
| Profiler Sections
| -------------------------------------------------------------------------
| This file lets you determine whether or not various sections of Profiler
| data are displayed when the Profiler is enabled.
| Please see the user guide for info:
|
| https://codeigniter.com/user_guide/general/profiling.html
|
*/

View File

@@ -2,7 +2,7 @@
namespace App\Controllers;
use app\Models\Attribute;
use App\Models\Attribute;
require_once('Secure_Controller.php');
@@ -21,7 +21,7 @@ class Attributes extends Secure_Controller
$this->attribute = model('Attribute');
}
public function index(): void
public function getIndex(): void
{
$data['table_headers'] = get_attribute_definition_manage_table_headers();

View File

@@ -3,12 +3,10 @@
namespace App\Controllers;
use CodeIgniter\Controller;
use CodeIgniter\Database\BaseConnection;
use CodeIgniter\HTTP\CLIRequest;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Config\Database;
use Psr\Log\LoggerInterface;
/**
@@ -20,44 +18,41 @@ use Psr\Log\LoggerInterface;
* class Home extends BaseController
*
* For security be sure to declare any new methods as protected or private.
*
* @property BaseConnection db
*/
class BaseController extends Controller
abstract class BaseController extends Controller
{
/**
* Instance of the main Request object.
*
* @var IncomingRequest|CLIRequest
*/
protected $request;
/**
* Instance of the main Request object.
*
* @var CLIRequest|IncomingRequest
*/
protected $request;
/**
* An array of helpers to be loaded automatically upon
* class instantiation. These helpers will be available
* to all other controllers that extend BaseController.
*
* @var array
*/
protected $helpers = ['form', 'url', 'tabular', 'text', 'locale', 'html', 'download', 'directory', 'migration', 'importfile'];
/**
* An array of helpers to be loaded automatically upon
* class instantiation. These helpers will be available
* to all other controllers that extend BaseController.
*
* @var array
*/
protected $helpers = [];
/**
* Constructor.
*
* @param RequestInterface $request
* @param ResponseInterface $response
* @param LoggerInterface $logger //TODO: Need to sort this out. Multiple definitions exist for class 'LoggerInterface'
*/
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
// Do Not Edit This Line
parent::initController($request, $response, $logger);
/**
* Be sure to declare properties for any property fetch you initialized.
* The creation of dynamic property is deprecated in PHP 8.2.
*/
// protected $session;
//--------------------------------------------------------------------
// Preload any models, libraries, etc, here.
//--------------------------------------------------------------------
// E.g.: $this->session = \Config\Services::session();
$this->db = Database::connect();
}
/**
* Constructor.
*/
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
// Do Not Edit This Line
parent::initController($request, $response, $logger);
// Preload any models, libraries, etc, here.
// E.g.: $this->session = \Config\Services::session();
}
}

View File

@@ -2,9 +2,9 @@
namespace App\Controllers;
use app\Models\Cashup;
use app\Models\Expense;
use app\Models\Reports\Summary_payments;
use App\Models\Cashup;
use App\Models\Expense;
use App\Models\Reports\Summary_payments;
/**
* @property cashup cashup
@@ -22,7 +22,7 @@ class Cashups extends Secure_Controller
$this->summary_payments = model('Reports/Summary_payments');
}
public function index(): void
public function getIndex(): void
{
$data['table_headers'] = get_cashups_manage_table_headers();
@@ -102,7 +102,7 @@ class Cashups extends Secure_Controller
$cash_ups_info->closed_amount_cash = $cash_ups_info->open_amount_cash + $cash_ups_info->transfer_amount_cash;
// if it's date mode only and not date & time truncate the open and end date to date only
if(empty(config('OSPOS')->date_or_time_format))
if(empty(config('OSPOS')->settings['date_or_time_format']))
{
// search for all the payments given the time range
$inputs = [
@@ -186,10 +186,10 @@ class Cashups extends Secure_Controller
public function save(int $cashup_id = -1): void //TODO: Need to replace -1 with a constant in constants.php
{
$open_date = $this->request->getPost('open_date', FILTER_SANITIZE_STRING);
$open_date_formatter = date_create_from_format(config('OSPOS')->dateformat . ' ' . config('OSPOS')->timeformat, $open_date);
$open_date_formatter = date_create_from_format(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], $open_date);
$close_date = $this->request->getPost('close_date', FILTER_SANITIZE_NUMBER_INT);
$close_date_formatter = date_create_from_format(config('OSPOS')->dateformat . ' ' . config('OSPOS')->timeformat, $close_date);
$close_date_formatter = date_create_from_format(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], $close_date);
$cash_up_data = [
'open_date' => $open_date_formatter->format('Y-m-d H:i:s'),

View File

@@ -2,20 +2,20 @@
namespace App\Controllers;
use app\Libraries\Barcode_lib;
use app\Libraries\Mailchimp_lib;
use app\Libraries\Receiving_lib;
use app\Libraries\Sale_lib;
use app\Libraries\Tax_lib;
use App\Libraries\Barcode_lib;
use App\Libraries\Mailchimp_lib;
use App\Libraries\Receiving_lib;
use App\Libraries\Sale_lib;
use App\Libraries\Tax_lib;
use app\Models\Appconfig;
use app\Models\Attribute;
use app\Models\Customer_rewards;
use app\Models\Dinner_table;
use app\Models\Module;
use app\Models\Enums\Rounding_mode;
use app\Models\Stock_location;
use app\Models\Tax;
use App\Models\Appconfig;
use App\Models\Attribute;
use App\Models\Customer_rewards;
use App\Models\Dinner_table;
use App\Models\Module;
use App\Models\Enums\Rounding_mode;
use App\Models\Stock_location;
use App\Models\Tax;
use CodeIgniter\Encryption\Encryption;
use CodeIgniter\Encryption\EncrypterInterface;
@@ -244,13 +244,13 @@ class Config extends Secure_Controller
/**
* @throws ReflectionException
*/
public function index(): void
public function getIndex(): void
{
$data['stock_locations'] = $this->stock_location->get_all()->getResultArray();
$data['dinner_tables'] = $this->dinner_table->get_all()->getResultArray();
$data['customer_rewards'] = $this->customer_rewards->get_all()->getResultArray();
$data['support_barcode'] = $this->barcode_lib->get_list_barcodes();
$data['logo_exists'] = config('OSPOS')->company_logo != '';
$data['logo_exists'] = config('OSPOS')->settings['company_logo'] != '';
$data['line_sequence_options'] = $this->sale_lib->get_line_sequence_options();
$data['register_mode_options'] = $this->sale_lib->get_register_mode_options();
$data['invoice_type_options'] = $this->sale_lib->get_invoice_type_options();
@@ -259,7 +259,7 @@ class Config extends Secure_Controller
$data['tax_category_options'] = $this->tax_lib->get_tax_category_options();
$data['tax_jurisdiction_options'] = $this->tax_lib->get_tax_jurisdiction_options();
$data['show_office_group'] = $this->module->get_show_office_group();
$data['currency_code'] = config('OSPOS')->currency_code;
$data['currency_code'] = config('OSPOS')->settings['currency_code'];
// load all the license statements, they are already XSS cleaned in the private function
$data['licenses'] = $this->_licenses();
@@ -271,15 +271,15 @@ class Config extends Secure_Controller
$image_allowed_types = ['jpg','jpeg','gif','svg','webp','bmp','png','tif','tiff'];
$data['image_allowed_types'] = array_combine($image_allowed_types,$image_allowed_types);
$data['selected_image_allowed_types'] = explode('|', config('OSPOS')->image_allowed_types);
$data['selected_image_allowed_types'] = explode('|', config('OSPOS')->settings['image_allowed_types']);
//Load Integrations Related fields
$data['mailchimp'] = [];
if($this->_check_encryption()) //TODO: Hungarian notation
{
$data['mailchimp']['api_key'] = $this->encrypter->decrypt(config('OSPOS')->mailchimp_api_key);
$data['mailchimp']['list_id'] = $this->encrypter->decrypt(config('OSPOS')->mailchimp_list_id);
$data['mailchimp']['api_key'] = $this->encrypter->decrypt(config('OSPOS')->settings['mailchimp_api_key']);
$data['mailchimp']['list_id'] = $this->encrypter->decrypt(config('OSPOS')->settings['mailchimp_list_id']);
}
else
{
@@ -649,7 +649,7 @@ class Config extends Secure_Controller
$this->db->transStart();
$not_to_delete = [];
foreach($this->request->getPost(NULL, FILTER_SANITIZE_STRING) as $key => $value) //TODO: Not sure if this is the best way to sanitize this array.
foreach($this->request->getPost(NULL, FILTER_SANITIZE_STRING) as $key => $value)
{
if(strstr($key, 'stock_location'))
{
@@ -911,7 +911,7 @@ class Config extends Secure_Controller
// switches immediately back to the register the mode reflects the change
if($success == TRUE)
{
if(config('OSPOS')->invoice_enable)
if(config('OSPOS')->settings['invoice_enable'])
{
$this->sale_lib->set_mode($batch_save_data['default_register_mode']);
}
@@ -939,7 +939,7 @@ class Config extends Secure_Controller
*/
private function _check_encryption(): bool //TODO: Hungarian notation
{
$encryption_key = config('OSPOS')->encryption_key;
$encryption_key = config('OSPOS')->settings['encryption_key'];
// check if the encryption_key config item is the default one
if($encryption_key == '' || $encryption_key == 'YOUR KEY')

View File

@@ -2,11 +2,11 @@
namespace App\Controllers;
use app\Libraries\Mailchimp_lib;
use App\Libraries\Mailchimp_lib;
use app\Models\Customer;
use app\Models\Customer_rewards;
use app\Models\Tax_code;
use App\Models\Customer;
use App\Models\Customer_rewards;
use App\Models\Tax_code;
use CodeIgniter\Encryption\Encryption;
use CodeIgniter\Encryption\EncrypterInterface;
@@ -38,13 +38,13 @@ class Customers extends Persons
$this->customer = model('Customer');
$this->tax_code = model('Tax_code');
$this->encryption = new Encryption(); //TODO: Is this the correct way to load the encryption service now?
$this->encryption = new Encryption();
$this->encrypter = $this->encryption->initialize();
$this->_list_id = $this->encrypter->decrypt(config('OSPOS')->mailchimp_list_id);
$this->_list_id = $this->encrypter->decrypt(config('OSPOS')->settings['mailchimp_list_id']);
}
public function index(): void
public function getIndex(): void
{
$data['table_headers'] = get_customer_manage_table_headers();
@@ -174,7 +174,7 @@ class Customers extends Persons
$data['packages'] = $packages;
$data['selected_package'] = $info->package_id;
if(config('OSPOS')->use_destination_based_tax) //TODO: This can be shortened for ternary notation
if(config('OSPOS')->settings['use_destination_based_tax']) //TODO: This can be shortened for ternary notation
{
$data['use_destination_based_tax'] = TRUE;
}
@@ -280,7 +280,7 @@ class Customers extends Persons
'comments' => $this->request->getPost('comments', FILTER_SANITIZE_STRING)
];
$date_formatter = date_create_from_format(config('OSPOS')->dateformat . ' ' . config('OSPOS')->timeformat, $this->request->getPost('date', FILTER_SANITIZE_STRING));
$date_formatter = date_create_from_format(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], $this->request->getPost('date', FILTER_SANITIZE_STRING));
$customer_data = [
'consent' => $this->request->getPost('consent') != NULL,

View File

@@ -2,7 +2,7 @@
namespace App\Controllers;
use app\Models\Module;
use App\Models\Module;
/**
*

View File

@@ -2,8 +2,8 @@
namespace App\Controllers;
use app\Models\Expense;
use app\Models\Expense_category;
use App\Models\Expense;
use App\Models\Expense_category;
/**
* @property expense expense
@@ -19,7 +19,7 @@ class Expenses extends Secure_Controller
$this->expense_category = model('Expense_category');
}
public function index(): void
public function getIndex(): void
{
$data['table_headers'] = get_expenses_manage_table_headers();
@@ -137,7 +137,7 @@ class Expenses extends Secure_Controller
{
$newdate = $this->request->getPost('date', FILTER_SANITIZE_STRING);
$date_formatter = date_create_from_format(config('OSPOS')->dateformat . ' ' . config('OSPOS')->timeformat, $newdate);
$date_formatter = date_create_from_format(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], $newdate);
$expense_data = [
'date' => $date_formatter->format('Y-m-d H:i:s'),

View File

@@ -2,7 +2,7 @@
namespace App\Controllers;
use app\Models\Expense_category;
use App\Models\Expense_category;
/**
* @property expense_category expense_category
@@ -16,7 +16,7 @@ class Expenses_categories extends Secure_Controller //TODO: Is this class ever u
$this->expense_category = model('Expense_category');
}
public function index(): void
public function getIndex(): void
{
$data['table_headers'] = get_expense_category_manage_table_headers();

View File

@@ -2,7 +2,7 @@
namespace App\Controllers;
use app\Models\Giftcard;
use App\Models\Giftcard;
/**
* @property giftcard giftcard
@@ -16,7 +16,7 @@ class Giftcards extends Secure_Controller
$this->giftcard = model('Giftcard');
}
public function index(): void
public function getIndex(): void
{
$data['table_headers'] = get_giftcards_manage_table_headers();
@@ -77,7 +77,7 @@ class Giftcards extends Secure_Controller
$data['selected_person_name'] = ($giftcard_id > 0 && isset($giftcard_info->person_id)) ? $giftcard_info->first_name . ' ' . $giftcard_info->last_name : '';
$data['selected_person_id'] = $giftcard_info->person_id;
if(config('OSPOS')->giftcard_number == 'random')
if(config('OSPOS')->settings['giftcard_number'] == 'random')
{
$data['giftcard_number'] = $giftcard_id > 0 ? $giftcard_info->giftcard_number : '';
}

View File

@@ -9,7 +9,7 @@ class Home extends Secure_Controller
parent::__construct(NULL, NULL, 'home');
}
public function index(): void
public function getIndex(): void
{
echo view('home/home');
}

View File

@@ -2,11 +2,11 @@
namespace App\Controllers;
use app\Libraries\Barcode_lib;
use App\Libraries\Barcode_lib;
use app\Models\Item;
use app\Models\Item_kit;
use app\Models\Item_kit_items;
use App\Models\Item;
use App\Models\Item_kit;
use App\Models\Item_kit_items;
/**
*
@@ -64,7 +64,7 @@ class Item_kits extends Secure_Controller
return $item_kit;
}
public function index(): void
public function getIndex(): void
{
$data['table_headers'] = get_item_kits_manage_table_headers();

View File

@@ -2,18 +2,18 @@
namespace App\Controllers;
use app\Libraries\Barcode_lib;
use app\Libraries\Item_lib;
use App\Libraries\Barcode_lib;
use App\Libraries\Item_lib;
use app\Models\Attribute;
use app\Models\Inventory;
use app\Models\Item;
use app\Models\Item_kit;
use app\Models\Item_quantity;
use app\Models\Item_taxes;
use app\Models\Stock_location;
use app\Models\Supplier;
use app\Models\Tax_category;
use App\Models\Attribute;
use App\Models\Inventory;
use App\Models\Item;
use App\Models\Item_kit;
use App\Models\Item_quantity;
use App\Models\Item_taxes;
use App\Models\Stock_location;
use App\Models\Supplier;
use App\Models\Tax_category;
use Config\Services;
use CodeIgniter\Files\File;
@@ -58,7 +58,7 @@ class Items extends Secure_Controller
$this->tax_category = model('Tax_category');
}
public function index(): void
public function getIndex(): void
{
$this->session->set('allow_temp_items', 0);
@@ -284,9 +284,9 @@ class Items extends Secure_Controller
}
}
$use_destination_based_tax = (boolean)config('OSPOS')->use_destination_based_tax;
$data['include_hsn'] = config('OSPOS')->include_hsn === '1';
$data['category_dropdown'] = config('OSPOS')->category_dropdown;
$use_destination_based_tax = (boolean)config('OSPOS')->settings['use_destination_based_tax'];
$data['include_hsn'] = config('OSPOS')->settings['include_hsn'] === '1';
$data['category_dropdown'] = config('OSPOS')->settings['category_dropdown'];
if($data['category_dropdown'] === '1')
{
@@ -300,8 +300,8 @@ class Items extends Secure_Controller
if($item_id === NEW_ITEM)
{
$data['default_tax_1_rate'] = config('OSPOS')->default_tax_1_rate;
$data['default_tax_2_rate'] = config('OSPOS')->default_tax_2_rate;
$data['default_tax_1_rate'] = config('OSPOS')->settings['default_tax_1_rate'];
$data['default_tax_2_rate'] = config('OSPOS')->settings['default_tax_2_rate'];
$item_info->receiving_quantity = 1;
$item_info->reorder_level = 1;
@@ -314,7 +314,7 @@ class Items extends Secure_Controller
if($use_destination_based_tax)
{
$item_info->tax_category_id = config('OSPOS')->default_tax_category;
$item_info->tax_category_id = config('OSPOS')->settings['default_tax_category'];
}
}
@@ -322,7 +322,7 @@ class Items extends Secure_Controller
$data['item_kit_disabled']
&& $item_info->item_type == ITEM_KIT
&& !$data['allow_temp_item']
&& !(config('OSPOS')->derive_sale_quantity === '1')
&& !(config('OSPOS')->settings['derive_sale_quantity'] === '1')
);
$data['item_info'] = $item_info;
@@ -471,7 +471,7 @@ class Items extends Secure_Controller
foreach($result as &$item)
{
if(empty($item['item_number']) && config('OSPOS')->barcode_generate_if_empty)
if(empty($item['item_number']) && config('OSPOS')->settings['barcode_generate_if_empty'])
{
$barcode_instance = Barcode_lib::barcode_instance($item, $config);
$item['item_number'] = $barcode_instance->getData();
@@ -620,7 +620,7 @@ class Items extends Secure_Controller
$new_item = TRUE;
}
$use_destination_based_tax = (bool)config('OSPOS')->use_destination_based_tax;
$use_destination_based_tax = (bool)config('OSPOS')->settings['use_destination_based_tax'];
if(!$use_destination_based_tax)
{
@@ -733,9 +733,9 @@ class Items extends Secure_Controller
'rules' => [
'uploaded[items_image]',
'is_image[items_image]',
'max_size[items_image,' . config('OSPOS')->image_max_size.']',
'max_dims[items_image,' . config('OSPOS')->image_max_width . ',' . config('OSPOS')->image_max_height . ']',
'ext_in[items_image,' . config('OSPOS')->image_allowed_types . ']'
'max_size[items_image,' . config('OSPOS')->settings['image_max_size'] . ']',
'max_dims[items_image,' . config('OSPOS')->settings['image_max_width'] . ',' . config('OSPOS')->settings['image_max_height'] . ']',
'ext_in[items_image,' . config('OSPOS')->settings['image_allowed_types'] . ']'
]
]
];

View File

@@ -2,126 +2,61 @@
namespace App\Controllers;
use App\Libraries\MY_Migration;
use App\Models\Employee;
use Config\Services;
/**
* @property employee employee
*/
class Login extends BaseController
{
public function __construct()
{
$this->employee = model('Employee');
}
protected $helpers = ['form'];
public function index()
{
$this->employee = model('Employee');
if($this->employee->is_logged_in())
if(!$this->employee->is_logged_in())
{
redirect('home');
}
else
{
$this->validator->setRule('username', 'lang:login_username', 'required|callback_login_check');
$migration = new MY_Migration(config('Migrations'));
if(!$this->validate([]))
//The gcaptcha_enable key was not added to app settings until 3.1.1. Without this check we get an error on new instances.
$gcaptcha_enabled = array_key_exists('gcaptcha_enable', config('OSPOS')->settings)
? config('OSPOS')->settings['gcaptcha_enable']
: false;
$migration->migrate_to_ci4();
$data = [
'has_errors' => false,
'is_latest' => $migration->is_latest(),
'latest_version' => $migration->get_latest_migration(),
'gcaptcha_enabled' => $gcaptcha_enabled
];
if(strtolower($this->request->getMethod()) !== 'post')
{
echo view('login', ['validation' => $this->validator]);
return view('login', $data);
}
else
$rules = ['username' => 'required|login_check[data]'];
$messages = ['username' => lang('Login.invalid_username_and_password')];
if(!$this->validate($rules, $messages))
{
redirect('home');
$validation = Services::validation();
$data['has_errors'] = !empty($validation->getErrors());
return view('login', $data);
}
if(!$data['is_latest'])
{
set_time_limit(3600);
$migration->setNamespace('App')->latest();
}
}
return redirect()->to('home');
}
public function login_check($username)
{
if(!$this->installation_check())
{
$this->validator->setMessage('login_check', lang('login_invalid_installation')); //TODO: This is going to need some work https://codeigniter.com/user_guide/libraries/validation.html?highlight=validation#setting-custom-error-messages
return FALSE;
}
$password = $this->request->getPost('password');
if(!$this->employee->login($username, $password))
{
$this->validatior->set_message('login_check', $this->lang->line('login_invalid_username_and_password'));
return FALSE;
}
if(config('OSPOS')->gcaptcha_enable)
{
$g_recaptcha_response = $this->request->getPost('g-recaptcha-response');
if(!$this->gcaptcha_check($g_recaptcha_response))
{
$this->validator->setMessage('login_check', lang('login_invalid_gcaptcha'));
return FALSE;
}
}
return TRUE;
}
private function gcaptcha_check($response): bool
{
if(!empty($response))
{
$check = array(
'secret' => config('OSPOS')->gcaptcha_secret_key,
'response' => $response,
'remoteip' => $this->request->getIPAddress()
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify");
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($check));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
$status = json_decode($result, TRUE);
if(!empty($status['success']))
{
return TRUE;
}
}
return FALSE;
}
private function installation_check()
{
// get PHP extensions and check that the required ones are installed
$extensions = implode(', ', get_loaded_extensions());
$keys = array('bcmath', 'intl', 'gd', 'openssl', 'mbstring', 'curl');
$pattern = '/';
foreach($keys as $key)
{
$pattern .= '(?=.*\b' . preg_quote($key, '/') . '\b)';
}
$pattern .= '/i';
$result = preg_match($pattern, $extensions);
if(!$result)
{
error_log('Check your php.ini');
error_log('PHP installed extensions: ' . $extensions);
error_log('PHP required extensions: ' . implode(', ', $keys));
}
return $result;
}
}
}

View File

@@ -2,9 +2,9 @@
namespace App\Controllers;
use app\Libraries\Sms_lib;
use App\Libraries\Sms_lib;
use app\Models\Person;
use App\Models\Person;
/**
*
@@ -25,7 +25,7 @@ class Messages extends Secure_Controller
$this->person = model('Person');
}
public function index(): void
public function getIndex(): void
{
echo view('messages/sms');
}

View File

@@ -2,7 +2,7 @@
namespace App\Controllers;
use app\Models\Module;
use App\Models\Module;
/**
* Part of the grants mechanism to restrict access to modules that the user doesn't have permission for.
@@ -16,7 +16,7 @@ class No_Access extends BaseController
{
$this->module = model('Module');
}
public function index(string $module_id = '', string $permission_id = ''): void
public function getIndex(string $module_id = '', string $permission_id = ''): void
{
$data['module_name'] = $this->module->get_module_name($module_id);
$data['permission_id'] = $permission_id;

View File

@@ -2,7 +2,7 @@
namespace App\Controllers;
use app\Models\Employee;
use App\Models\Employee;
/**
* @property employee employee
@@ -14,7 +14,7 @@ class Office extends Secure_Controller
parent::__construct('office', NULL, 'office');
}
public function index(): void
public function getIndex(): void
{
echo view('home/office');
}

View File

@@ -2,7 +2,7 @@
namespace App\Controllers;
use app\Models\Person;
use App\Models\Person;
/**
* @property person person
@@ -16,7 +16,7 @@ abstract class Persons extends Secure_Controller
$this->person = model('Person');
}
public function index(): void
public function getIndex(): void
{
$data['table_headers'] = get_people_manage_table_headers();

View File

@@ -2,15 +2,15 @@
namespace App\Controllers;
use app\Libraries\Receiving_lib;
use app\Libraries\Token_lib;
use app\Libraries\Barcode_lib;
use app\Models\Inventory;
use app\Models\Item;
use app\Models\Item_kit;
use app\Models\Receiving;
use app\Models\Stock_location;
use app\Models\Supplier;
use App\Libraries\Receiving_lib;
use App\Libraries\Token_lib;
use App\Libraries\Barcode_lib;
use App\Models\Inventory;
use App\Models\Item;
use App\Models\Item_kit;
use App\Models\Receiving;
use App\Models\Stock_location;
use App\Models\Supplier;
use ReflectionException;
/**
@@ -42,7 +42,7 @@ class Receivings extends Secure_Controller
$this->supplier = model('Supplier');
}
public function index(): void
public function getIndex(): void
{
$this->_reload();
}
@@ -135,8 +135,8 @@ class Receivings extends Secure_Controller
$this->token_lib->parse_barcode($quantity, $price, $item_id_or_number_or_item_kit_or_receipt);
$quantity = ($mode == 'receive' || $mode == 'requisition') ? $quantity : -$quantity;
$item_location = $this->receiving_lib->get_stock_source();
$discount = config('OSPOS')->default_receivings_discount;
$discount_type = config('OSPOS')->default_receivings_discount_type;
$discount = config('OSPOS')->settings['default_receivings_discount'];
$discount_type = config('OSPOS')->settings['default_receivings_discount_type'];
if($mode == 'return' && $this->receiving->is_valid_receipt($item_id_or_number_or_item_kit_or_receipt))
{
@@ -445,7 +445,7 @@ class Receivings extends Secure_Controller
{
$newdate = $this->request->getPost('date', FILTER_SANITIZE_STRING); //TODO: newdate does not follow naming conventions
$date_formatter = date_create_from_format(config('OSPOS')->dateformat . ' ' . config('OSPOS')->timeformat, $newdate);
$date_formatter = date_create_from_format(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], $newdate);
$receiving_time = $date_formatter->format('Y-m-d H:i:s');
$receiving_data = [

View File

@@ -2,29 +2,29 @@
namespace App\Controllers;
use app\Models\Attribute;
use app\Models\Customer;
use app\Models\Stock_location;
use app\Models\Supplier;
use app\Models\Reports\Detailed_receivings;
use app\Models\Reports\Detailed_sales;
use app\Models\Reports\Inventory_low;
use app\Models\Reports\Inventory_summary;
use app\Models\Reports\Specific_customer;
use app\Models\Reports\Specific_discount;
use app\Models\Reports\Specific_employee;
use app\Models\Reports\Specific_supplier;
use app\Models\Reports\Summary_categories;
use app\Models\Reports\Summary_customers;
use app\Models\Reports\Summary_discounts;
use app\Models\Reports\Summary_employees;
use app\Models\Reports\Summary_expenses_categories;
use app\Models\Reports\Summary_items;
use app\Models\Reports\Summary_payments;
use app\Models\Reports\Summary_sales;
use app\Models\Reports\Summary_sales_taxes;
use app\Models\Reports\Summary_suppliers;
use app\Models\Reports\Summary_taxes;
use App\Models\Attribute;
use App\Models\Customer;
use App\Models\Stock_location;
use App\Models\Supplier;
use App\Models\Reports\Detailed_receivings;
use App\Models\Reports\Detailed_sales;
use App\Models\Reports\Inventory_low;
use App\Models\Reports\Inventory_summary;
use App\Models\Reports\Specific_customer;
use App\Models\Reports\Specific_discount;
use App\Models\Reports\Specific_employee;
use App\Models\Reports\Specific_supplier;
use App\Models\Reports\Summary_categories;
use App\Models\Reports\Summary_customers;
use App\Models\Reports\Summary_discounts;
use App\Models\Reports\Summary_employees;
use App\Models\Reports\Summary_expenses_categories;
use App\Models\Reports\Summary_items;
use App\Models\Reports\Summary_payments;
use App\Models\Reports\Summary_sales;
use App\Models\Reports\Summary_sales_taxes;
use App\Models\Reports\Summary_suppliers;
use App\Models\Reports\Summary_taxes;
use CodeIgniter\HTTP\Uri;
/**
@@ -80,7 +80,7 @@ class Reports extends Secure_Controller
}
//Initial Report listing screen
public function index(): void
public function getIndex(): void
{
$data['grants'] = $this->employee->get_employee_grants($this->session->get('person_id'));
@@ -1577,10 +1577,10 @@ class Reports extends Secure_Controller
$sale_type_options = [];
$sale_type_options['complete'] = lang('Reports.complete');
$sale_type_options['sales'] = lang('Reports.completed_sales');
if(config('OSPOS')->invoice_enable)
if(config('OSPOS')->settings['invoice_enable'])
{
$sale_type_options['quotes'] = lang('Reports.quotes');
if(config('OSPOS')->work_order_enable)
if(config('OSPOS')->settings['work_order_enable'])
{
$sale_type_options['work_orders'] = lang('Reports.work_orders');
}
@@ -1912,13 +1912,13 @@ class Reports extends Secure_Controller
{
$subtitle = '';
if(empty(config('OSPOS')->date_or_time_format))
if(empty(config('OSPOS')->settings['date_or_time_format']))
{
$subtitle .= date(config('OSPOS')->dateformat, strtotime($inputs['start_date'])) . ' - ' . date(config('OSPOS')->dateformat, strtotime($inputs['end_date']));
$subtitle .= date(config('OSPOS')->settings['dateformat'], strtotime($inputs['start_date'])) . ' - ' . date(config('OSPOS')->settings['dateformat'], strtotime($inputs['end_date']));
}
else
{
$subtitle .= date(config('OSPOS')->dateformat . ' ' . config('OSPOS')->timeformat, strtotime(rawurldecode($inputs['start_date']))) . ' - ' . date(config('OSPOS')->dateformat . ' ' . config('OSPOS')->timeformat, strtotime(rawurldecode($inputs['end_date'])));
$subtitle .= date(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], strtotime(rawurldecode($inputs['start_date']))) . ' - ' . date(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], strtotime(rawurldecode($inputs['end_date'])));
}
return $subtitle;

View File

@@ -2,24 +2,24 @@
namespace App\Controllers;
use app\Libraries\Barcode_lib;
use app\Libraries\Email_lib;
use app\Libraries\Sale_lib;
use app\Libraries\Tax_lib;
use app\Libraries\Token_lib;
use app\Models\Customer;
use app\Models\Customer_rewards;
use app\Models\Dinner_table;
use app\Models\Employee;
use app\Models\Giftcard;
use app\Models\Inventory;
use app\Models\Item;
use app\Models\Item_kit;
use app\Models\Sale;
use app\Models\Stock_location;
use app\Models\Tokens\Token_invoice_count;
use app\Models\Tokens\Token_customer;
use app\Models\Tokens\Token_invoice_sequence;
use App\Libraries\Barcode_lib;
use App\Libraries\Email_lib;
use App\Libraries\Sale_lib;
use App\Libraries\Tax_lib;
use App\Libraries\Token_lib;
use App\Models\Customer;
use App\Models\Customer_rewards;
use App\Models\Dinner_table;
use App\Models\Employee;
use App\Models\Giftcard;
use App\Models\Inventory;
use App\Models\Item;
use App\Models\Item_kit;
use App\Models\Sale;
use App\Models\Stock_location;
use App\Models\Tokens\Token_invoice_count;
use App\Models\Tokens\Token_customer;
use App\Models\Tokens\Token_invoice_sequence;
use CodeIgniter\Config\Services;
use ReflectionException;
@@ -55,7 +55,7 @@ class Sales extends Secure_Controller
$this->token_lib = new Token_lib();
}
public function index(): void
public function getIndex(): void
{
$this->session->set('allow_temp_items', 1);
$this->_reload(); //TODO: Hungarian Notation
@@ -109,7 +109,7 @@ class Sales extends Secure_Controller
'only_due' => FALSE,
'only_check' => FALSE,
'only_creditcard' => FALSE,
'only_invoices' => config('OSPOS')->invoice_enable && $this->request->getGet('only_invoices', FILTER_SANITIZE_NUMBER_INT),
'only_invoices' => config('OSPOS')->settings['invoice_enable'] && $this->request->getGet('only_invoices', FILTER_SANITIZE_NUMBER_INT),
'is_valid_receipt' => $this->sale->is_valid_receipt($search)
];
@@ -210,7 +210,7 @@ class Sales extends Secure_Controller
$this->sale_lib->set_sale_type(SALE_TYPE_RETURN);
}
if(config('OSPOS')->dinner_table_enable)
if(config('OSPOS')->settings['dinner_table_enable'])
{
$occupied_dinner_table = $this->request->getPost('dinner_table', FILTER_SANITIZE_NUMBER_INT);
$released_dinner_table = $this->sale_lib->get_dinner_table();
@@ -451,8 +451,8 @@ class Sales extends Secure_Controller
{
$data = [];
$discount = config('OSPOS')->default_sales_discount;
$discount_type = config('OSPOS')->default_sales_discount_type;
$discount = config('OSPOS')->settings['default_sales_discount'];
$discount_type = config('OSPOS')->settings['default_sales_discount_type'];
// check if any discount is assigned to the selected customer
$customer_id = $this->sale_lib->get_customer();
@@ -625,7 +625,7 @@ class Sales extends Secure_Controller
$data['cart'] = $this->sale_lib->get_cart();
$data['include_hsn'] = (bool)config('OSPOS')->include_hsn;
$data['include_hsn'] = (bool)config('OSPOS')->settings['include_hsn'];
$__time = time();
$data['transaction_time'] = to_datetime($__time);
$data['transaction_date'] = to_date($__time);
@@ -635,16 +635,16 @@ class Sales extends Secure_Controller
$employee_info = $this->employee->get_info($employee_id);
$data['employee'] = $employee_info->first_name . ' ' . mb_substr($employee_info->last_name, 0, 1);
$data['company_info'] = implode("\n", [config('OSPOS')->address, config('OSPOS')->phone]);
$data['company_info'] = implode("\n", [config('OSPOS')->settings['address'], config('OSPOS')->settings['phone']]);
if(config('OSPOS')->account_number)
if(config('OSPOS')->settings['account_number'])
{
$data['company_info'] .= "\n" . lang('Sales.account_number') . ": " . config('OSPOS')->account_number;
$data['company_info'] .= "\n" . lang('Sales.account_number') . ": " . config('OSPOS')->settings['account_number'];
}
if(config('OSPOS')->tax_id != '')
if(config('OSPOS')->settings['tax_id'] != '')
{
$data['company_info'] .= "\n" . lang('Sales.tax_id') . ": " . config('OSPOS')->tax_id;
$data['company_info'] .= "\n" . lang('Sales.tax_id') . ": " . config('OSPOS')->settings['tax_id'];
}
$data['invoice_number_enabled'] = $this->sale_lib->is_invoice_mode();
@@ -723,7 +723,7 @@ class Sales extends Secure_Controller
if($this->sale_lib->is_invoice_mode())
{
$invoice_format = config('OSPOS')->sales_invoice_format;
$invoice_format = config('OSPOS')->settings['sales_invoice_format'];
// generate final invoice number (if using the invoice in sales by receipt mode then the invoice number can be manually entered or altered in some way
if(!empty($invoice_format) && $invoice_number == NULL)
@@ -745,7 +745,7 @@ class Sales extends Secure_Controller
$sale_type = SALE_TYPE_INVOICE;
// The PHP file name is the same as the invoice_type key
$invoice_view = config('OSPOS')->invoice_type;
$invoice_view = config('OSPOS')->settings['invoice_type'];
// Save the data to the sales table
$data['sale_id_num'] = $this->sale->save_value($sale_id, $data['sale_status'], $data['cart'], $customer_id, $employee_id, $data['comments'], $invoice_number, $work_order_number, $quote_number, $sale_type, $data['payments'], $data['dinner_table'], $tax_details);
@@ -780,7 +780,7 @@ class Sales extends Secure_Controller
if($work_order_number == NULL)
{
// generate work order number
$work_order_format = config('OSPOS')->work_order_format;
$work_order_format = config('OSPOS')->settings['work_order_format'];
$work_order_number = $this->token_lib->render($work_order_format);
}
@@ -815,7 +815,7 @@ class Sales extends Secure_Controller
if($quote_number == NULL)
{
// generate quote number
$quote_format = config('OSPOS')->sales_quote_format;
$quote_format = config('OSPOS')->settings['sales_quote_format'];
$quote_number = $this->token_lib->render($quote_format);
}
@@ -892,14 +892,14 @@ class Sales extends Secure_Controller
$number = $sale_data[$type."_number"];
$subject = lang('Sales.' . $type) . ' ' . $number;
$text = config('OSPOS')->invoice_email_message;
$text = config('OSPOS')->settings['invoice_email_message'];
$tokens = [
new Token_invoice_sequence($sale_data['invoice_number']),
new Token_invoice_count('POS ' . $sale_data['sale_id']),
new Token_customer((object)$sale_data)
];
$text = $this->token_lib->render($text, $tokens);
$sale_data['mimetype'] = mime_content_type('uploads/' . config('OSPOS')->company_logo);
$sale_data['mimetype'] = mime_content_type(WRITEPATH . 'uploads/' . config('OSPOS')->settings['company_logo']);
// generate email attachment: invoice in pdf format
$view = Services::renderer();
@@ -1045,7 +1045,7 @@ class Sales extends Secure_Controller
$data['transaction_date'] = to_date(strtotime($sale_info['sale_time']));
$data['show_stock_locations'] = $this->stock_location->show_locations('sales');
$data['include_hsn'] = (bool)config('OSPOS')->include_hsn;
$data['include_hsn'] = (bool)config('OSPOS')->settings['include_hsn'];
// Returns 'subtotal', 'total', 'cash_total', 'payment_total', 'amount_due', 'cash_amount_due', 'payments_cover_total'
$totals = $this->sale_lib->get_totals($tax_details[0]);
@@ -1084,15 +1084,15 @@ class Sales extends Secure_Controller
$data['quote_number'] = $sale_info['quote_number'];
$data['sale_status'] = $sale_info['sale_status'];
$data['company_info'] = implode('\n', [config('OSPOS')->address, config('OSPOS')->phone]); //TODO: Duplicated code.
$data['company_info'] = implode('\n', [config('OSPOS')->settings['address'], config('OSPOS')->settings['phone']]); //TODO: Duplicated code.
if(config('OSPOS')->account_number)
if(config('OSPOS')->settings['account_number'])
{
$data['company_info'] .= '\n' . lang('Sales.account_number') . ": " . config('OSPOS')->account_number;
$data['company_info'] .= '\n' . lang('Sales.account_number') . ": " . config('OSPOS')->settings['account_number'];
}
if(config('OSPOS')->tax_id != '')
if(config('OSPOS')->settings['tax_id'] != '')
{
$data['company_info'] .= '\n' . lang('Sales.tax_id') . ": " . config('OSPOS')->tax_id;
$data['company_info'] .= '\n' . lang('Sales.tax_id') . ": " . config('OSPOS')->settings['tax_id'];
}
$data['barcode'] = $this->barcode_lib->generate_receipt_barcode($data['sale_id']);
@@ -1125,7 +1125,7 @@ class Sales extends Secure_Controller
$data['customer_required'] = lang('Sales.customer_optional');
}
$invoice_type = config('OSPOS')->invoice_type;
$invoice_type = config('OSPOS')->settings['invoice_type'];
$data['invoice_view'] = $invoice_type;
return $data;
@@ -1197,7 +1197,7 @@ class Sales extends Secure_Controller
$data['comment'] = $this->sale_lib->get_comment();
$data['email_receipt'] = $this->sale_lib->is_email_receipt();
if($customer_info && config('OSPOS')->customer_reward_enable)
if($customer_info && config('OSPOS')->settings['customer_reward_enable'])
{
$data['payment_options'] = $this->sale->get_payment_options(TRUE, TRUE);
}
@@ -1210,7 +1210,7 @@ class Sales extends Secure_Controller
$data['change_price'] = $this->employee->has_grant('sales_change_price', $this->employee->get_logged_in_employee_info()->person_id);
$temp_invoice_number = $this->sale_lib->get_invoice_number();
$invoice_format = config('OSPOS')->sales_invoice_format;
$invoice_format = config('OSPOS')->settings['sales_invoice_format'];
if ($temp_invoice_number == NULL || $temp_invoice_number == '')
{
@@ -1394,7 +1394,7 @@ class Sales extends Secure_Controller
$newdate = $this->request->getPost('date', FILTER_SANITIZE_STRING);
$employee_id = $this->employee->get_logged_in_employee_info()->person_id;
$date_formatter = date_create_from_format(config('OSPOS')->dateformat . ' ' . config('OSPOS')->timeformat, $newdate);
$date_formatter = date_create_from_format(config('OSPOS')->settings['dateformat'] . ' ' . config('OSPOS')->settings['timeformat'], $newdate);
$sale_time = $date_formatter->format('Y-m-d H:i:s');
$sale_data = [
@@ -1505,7 +1505,7 @@ class Sales extends Secure_Controller
{
$sale_type = $this->sale_lib->get_sale_type();
if(config('OSPOS')->dinner_table_enable)
if(config('OSPOS')->settings['dinner_table_enable'])
{
$dinner_table = $this->sale_lib->get_dinner_table();
$this->dinner_table->release($dinner_table);

View File

@@ -2,8 +2,8 @@
namespace App\Controllers;
use app\Models\Employee;
use app\Models\Module;
use App\Models\Employee;
use App\Models\Module;
use CodeIgniter\Session\Session;
@@ -26,7 +26,7 @@ class Secure_Controller extends BaseController
if(!$this->employee->is_logged_in())
{
redirect('login');
return redirect()->to('login');
}
$logged_in_employee_info = $this->employee->get_logged_in_employee_info();
@@ -64,7 +64,7 @@ class Secure_Controller extends BaseController
$data['user_info'] = $logged_in_employee_info;
$data['controller_name'] = $module_id;
$this->load->vars($data); //TODO: need to find out how to convert this.
echo view('viewData', $data);
}
public function check_numeric()
@@ -80,7 +80,7 @@ class Secure_Controller extends BaseController
}
// this is the basic set of methods most OSPOS Controllers will implement
public function index() { return FALSE; }
public function getIndex() { return FALSE; }
public function search() { return FALSE; }
public function suggest_search() { return FALSE; }
public function view(int $data_item_id = -1) { return FALSE; }

View File

@@ -2,7 +2,7 @@
namespace App\Controllers;
use app\Models\Supplier;
use App\Models\Supplier;
/**
*
@@ -19,7 +19,7 @@ class Suppliers extends Persons
$this->supplier = model('Supplier');
}
public function index(): void
public function getIndex(): void
{
$data['table_headers'] = get_suppliers_manage_table_headers();

View File

@@ -2,7 +2,7 @@
namespace App\Controllers;
use app\Models\Tax_category;
use App\Models\Tax_category;
/**
* @property tax_category tax_category
@@ -16,7 +16,7 @@ class Tax_categories extends Secure_Controller
$this->tax_category = model('Tax_category');
}
public function index(): void
public function getIndex(): void
{
$data['tax_categories_table_headers'] = get_tax_categories_table_headers();

View File

@@ -2,7 +2,7 @@
namespace App\Controllers;
use app\Models\Tax_code;
use App\Models\Tax_code;
/**
* @property tax_code tax_code
@@ -18,7 +18,7 @@ class Tax_codes extends Secure_Controller
}
public function index(): void
public function getIndex(): void
{
echo view('taxes/tax_codes', $this->get_data());
}

View File

@@ -2,7 +2,7 @@
namespace App\Controllers;
use app\Models\Tax_jurisdiction;
use App\Models\Tax_jurisdiction;
/**
* @property tax_jurisdiction tax_jurisdiction
@@ -19,7 +19,7 @@ class Tax_jurisdictions extends Secure_Controller
}
public function index(): void
public function getIndex(): void
{
$data['table_headers'] = get_tax_jurisdictions_table_headers();

View File

@@ -2,12 +2,12 @@
namespace App\Controllers;
use app\Libraries\Tax_lib;
use app\Models\enums\Rounding_mode;
use app\Models\Tax;
use app\Models\Tax_category;
use app\Models\Tax_code;
use app\Models\Tax_jurisdiction;
use App\Libraries\Tax_lib;
use App\Models\enums\Rounding_mode;
use App\Models\Tax;
use App\Models\Tax_category;
use App\Models\Tax_code;
use App\Models\Tax_jurisdiction;
/**
* @property tax_lib tax_lib
@@ -34,7 +34,7 @@ class Taxes extends Secure_Controller
helper('tax_helper');
}
public function index(): void
public function getIndex(): void
{
$data['tax_codes'] = $this->tax_code->get_all()->getResultArray();
if (count($data['tax_codes']) == 0)
@@ -58,7 +58,7 @@ class Taxes extends Secure_Controller
$data['tax_categories_table_headers'] = get_tax_categories_table_headers();
$data['tax_types'] = $this->tax_lib->get_tax_types();
if(config('OSPOS')->tax_included)
if(config('OSPOS')->settings['tax_included'])
{
$data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED;
}
@@ -134,7 +134,7 @@ class Taxes extends Secure_Controller
$tax_rate_info = $this->tax->get_rate_info($tax_code, $default_tax_category_id);
if(config('OSPOS')->tax_included)
if(config('OSPOS')->settings['tax_included'])
{
$data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED;
}
@@ -206,9 +206,9 @@ class Taxes extends Secure_Controller
if($tax_rate_id == -1) //TODO: Replace -1 with constant
{
$data['rate_tax_code_id'] = config('OSPOS')->default_tax_code;
$data['rate_tax_category_id'] = config('OSPOS')->default_tax_category;
$data['rate_jurisdiction_id'] = config('OSPOS')->default_tax_jurisdiction;
$data['rate_tax_code_id'] = config('OSPOS')->settings['default_tax_code'];
$data['rate_tax_category_id'] = config('OSPOS')->settings['default_tax_category'];
$data['rate_jurisdiction_id'] = config('OSPOS')->settings['default_tax_jurisdiction'];
$data['tax_rounding_code'] = rounding_mode::HALF_UP;
$data['tax_rate'] = '0.0000';
}
@@ -237,7 +237,7 @@ class Taxes extends Secure_Controller
$data['rounding_options'] = rounding_mode::get_rounding_options();
$data['html_rounding_options'] = $this->get_html_rounding_options();
if(config('OSPOS')->tax_included)
if(config('OSPOS')->settings['tax_included'])
{
$data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED;
}
@@ -304,7 +304,7 @@ class Taxes extends Secure_Controller
$data['rounding_options'] = rounding_mode::get_rounding_options();
$data['html_rounding_options'] = $this->get_html_rounding_options();
if(config('OSPOS')->tax_included)
if(config('OSPOS')->settings['tax_included'])
{
$data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED;
}
@@ -557,7 +557,7 @@ class Taxes extends Secure_Controller
{
$tax_jurisdictions = $this->tax_jurisdiction->get_all()->getResultArray();
if(config('OSPOS')->tax_included) //TODO: ternary notation
if(config('OSPOS')->settings['tax_included']) //TODO: ternary notation
{
$default_tax_type = Tax_lib::TAX_TYPE_INCLUDED;
}

View File

@@ -13,11 +13,12 @@ class Migration_Upgrade_To_3_1_1 extends Migration
public function up(): void
{
execute_script(APPPATH . 'migrations/sqlscripts/3.0.2_to_3.1.1.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.0.2_to_3.1.1.sql');
}
public function down(): void
{
}
}
}

View File

@@ -2,14 +2,12 @@
namespace App\Database\Migrations;
use app\Libraries\Tax_lib;
use app\Models\Appconfig;
use App\Libraries\Tax_lib;
use App\Models\Appconfig;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\ResultInterface;
/**
*
*
* @property tax_lib tax_lib
* @property appconfig appconfig
*/
@@ -25,19 +23,18 @@ class Migration_Sales_Tax_Data extends Migration
public function __construct()
{
parent::__construct();
$this->tax_lib = new Tax_lib();
$this->appconfig = model('Appconfig');
}
//TODO: we need to figure out why we get a server error when uncommented portions of this migration run
public function up(): void
{
$number_of_unmigrated = $this->get_count_of_unmigrated();
error_log("Migrating sales tax history. The number of sales that will be migrated is $number_of_unmigrated"); //TODO: String interpolation
error_log("Migrating sales tax history. The number of sales that will be migrated is $number_of_unmigrated");
if($number_of_unmigrated > 0)
{
$unmigrated_invoices = $this->get_unmigrated($number_of_unmigrated)->getResultArray();
foreach($unmigrated_invoices as $key => $unmigrated_invoice)
{
$this->upgrade_tax_history_for_sale($unmigrated_invoice['sale_id']);
@@ -335,4 +332,4 @@ class Migration_Sales_Tax_Data extends Migration
$sales_taxes[$row_number]['sale_tax_amount'] = $rounded_sale_tax_amount;
}
}
}
}

View File

@@ -8,11 +8,12 @@ class Migration_Upgrade_To_3_2_0 extends Migration
{
public function up(): void
{
execute_script(APPPATH . 'migrations/sqlscripts/3.1.1_to_3.2.0.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.1.1_to_3.2.0.sql');
}
public function down(): void
{
}
}
}

View File

@@ -8,11 +8,12 @@ class Migration_Upgrade_To_3_2_1 extends Migration
{
public function up(): void
{
execute_script(APPPATH . 'migrations/sqlscripts/3.2.0_to_3.2.1.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.2.0_to_3.2.1.sql');
}
public function down(): void
{
}
}
}

View File

@@ -8,11 +8,12 @@ class Migration_Attributes extends Migration
{
public function up(): void
{
execute_script(APPPATH . 'migrations/sqlscripts/3.3.0_attributes.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.0_attributes.sql');
}
public function down(): void
{
}
}
}

View File

@@ -8,11 +8,12 @@ class Migration_Upgrade_To_3_3_0 extends Migration
{
public function up(): void
{
execute_script(APPPATH . 'migrations/sqlscripts/3.2.1_to_3.3.0.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.2.1_to_3.3.0.sql');
}
public function down(): void
{
}
}
}

View File

@@ -14,7 +14,8 @@ class Migration_IndiaGST extends Migration
}
// If number of entries is greater than zero then the tax data needs to be migrated
execute_script(APPPATH . 'migrations/sqlscripts/3.3.0_indiagst.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.0_indiagst.sql');
error_log('Migrating tax configuration');
@@ -145,4 +146,4 @@ class Migration_IndiaGST extends Migration
$this->db->query('DROP TABLE IF EXISTS ' . $this->db->prefixTable('sales_taxes_backup'));
$this->db->query('DROP TABLE IF EXISTS ' . $this->db->prefixTable('tax_code_rates_backup'));
}
}
}

View File

@@ -8,7 +8,8 @@ class Migration_IndiaGST1 extends Migration
{
public function up(): void
{
execute_script(APPPATH . 'migrations/sqlscripts/3.3.0_indiagst1.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.0_indiagst1.sql');
error_log('Fix definition of Supplier.Tax Id');
@@ -19,4 +20,4 @@ class Migration_IndiaGST1 extends Migration
{
}
}
}

View File

@@ -8,11 +8,12 @@ class Migration_IndiaGST2 extends Migration
{
public function up(): void
{
execute_script(APPPATH . 'migrations/sqlscripts/3.3.0_indiagst2.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.0_indiagst2.sql');
}
public function down(): void
{
}
}
}

View File

@@ -8,11 +8,12 @@ class Migration_decimal_attribute_type extends Migration
{
public function up(): void
{
execute_script(APPPATH . 'migrations/sqlscripts/3.3.0_decimal_attribute_type.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.0_decimal_attribute_type.sql');
}
public function down(): void
{
}
}
}

View File

@@ -8,11 +8,12 @@ class Migration_add_iso_4217 extends Migration
{
public function up(): void
{
execute_script(APPPATH . 'migrations/sqlscripts/3.3.0_add_iso_4217.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.0_add_iso_4217.sql');
}
public function down(): void
{
}
}
}

View File

@@ -8,11 +8,12 @@ class Migration_PaymentTracking extends Migration
{
public function up(): void
{
execute_script(APPPATH . 'migrations/sqlscripts/3.3.0_paymenttracking.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.0_paymenttracking.sql');
}
public function down(): void
{
}
}
}

View File

@@ -8,7 +8,8 @@ class Migration_RefundTracking extends Migration
{
public function up(): void
{
execute_script(APPPATH . 'migrations/sqlscripts/3.3.0_refundtracking.sql');
helper(['migration', 'locale']);
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.0_refundtracking.sql');
// Add missing cash_refund amounts to payments table
$decimals = totals_decimals();
@@ -103,4 +104,4 @@ class Migration_RefundTracking extends Migration
{
}
}
}

View File

@@ -8,11 +8,12 @@ class Migration_DBFix extends Migration
{
public function up(): void
{
execute_script(APPPATH . 'migrations/sqlscripts/3.3.0_dbfix.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.0_dbfix.sql');
}
public function down(): void
{
}
}
}

View File

@@ -8,11 +8,12 @@ class Migration_fix_attribute_datetime extends Migration
{
public function up(): void
{
execute_script(APPPATH . 'migrations/sqlscripts/3.3.0_fix_attribute_datetime.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.0_fix_attribute_datetime.sql');
}
public function down(): void
{
}
}
}

View File

@@ -8,11 +8,12 @@ class Migration_PaymentDateFix extends Migration
{
public function up(): void
{
execute_script(APPPATH . 'migrations/sqlscripts/3.3.2_paymentdatefix.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.2_paymentdatefix.sql');
}
public function down(): void
{
}
}
}

View File

@@ -8,11 +8,12 @@ class Migration_SalesChangePrice extends Migration
{
public function up(): void
{
execute_script(APPPATH . 'migrations/sqlscripts/3.3.2_saleschangeprice.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.2_saleschangeprice.sql');
}
public function down(): void
{
}
}
}

View File

@@ -3,8 +3,8 @@
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use app\Libraries\Tax_lib;
use app\Models\Appconfig;
use App\Libraries\Tax_lib;
use App\Models\Appconfig;
use CodeIgniter\Database\ResultInterface;
/**
@@ -27,7 +27,6 @@ class Migration_TaxAmount extends Migration
parent::__construct();
$this->appconfig = model('Appconfig');
$this->tax_lib = new Tax_lib();
}
public function up(): void
@@ -314,4 +313,4 @@ class Migration_TaxAmount extends Migration
$sales_taxes[$row_number]['sale_tax_amount'] = $rounded_sale_tax_amount;
}
}
}
}

View File

@@ -10,8 +10,8 @@ class Migration_modify_attr_links_constraint extends Migration
{
error_log('Migrating modify_attr_links_constraint');
execute_script(APPPATH . 'migrations/sqlscripts/3.3.2_modify_attr_links_constraint.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.2_modify_attr_links_constraint.sql');
error_log('Migrating modify_attr_links_constraint');
}
@@ -19,4 +19,4 @@ class Migration_modify_attr_links_constraint extends Migration
public function down(): void
{
}
}
}

View File

@@ -10,7 +10,8 @@ class Migration_add_item_kit_number extends Migration
{
error_log('Migrating add_item_kit_number');
execute_script(APPPATH . 'migrations/sqlscripts/3.3.3_add_kits_item_number.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.3_add_kits_item_number.sql');
error_log('Migrating add_item_kit_number');
}
@@ -18,4 +19,4 @@ class Migration_add_item_kit_number extends Migration
public function down(): void
{
}
}
}

View File

@@ -10,7 +10,8 @@ class Migration_modify_session_datatype extends Migration
{
error_log('Migrating modify_session_datatype');
execute_script(APPPATH . 'migrations/sqlscripts/3.3.4_modify_session_datatype.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.4_modify_session_datatype.sql');
error_log('Migrating modify_session_datatype');
}
@@ -18,4 +19,4 @@ class Migration_modify_session_datatype extends Migration
public function down(): void
{
}
}
}

View File

@@ -4,7 +4,7 @@ namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\ResultInterface;
use app\Models\Attribute;
use App\Models\Attribute;
use DateTime;
class Migration_database_optimizations extends Migration
@@ -60,7 +60,7 @@ class Migration_database_optimizations extends Migration
break;
case DATE:
$attribute_date = DateTime::createFromFormat('Y-m-d', $attribute_value['attribute_date']);
$value = $attribute_date->format(config('OSPOS')->dateformat);
$value = $attribute_date->format(config('OSPOS')->settings['dateformat']);
break;
default:
$value = $attribute_value['attribute_value'];
@@ -72,7 +72,8 @@ class Migration_database_optimizations extends Migration
}
$this->db->transComplete();
execute_script(APPPATH . 'migrations/sqlscripts/3.4.0_database_optimizations.sql');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.4.0_database_optimizations.sql');
error_log('Migrating database_optimizations completed');
}
/**
@@ -89,7 +90,7 @@ class Migration_database_optimizations extends Migration
$builder->select("$column, attribute_id");
$builder->groupBy($column);
$builder->having("COUNT($column) > 1");
$duplicated_values = $builder->get('attribute_values');
$duplicated_values = $builder->get();
foreach($duplicated_values->getResultArray() as $duplicated_value)
{
@@ -130,4 +131,4 @@ class Migration_database_optimizations extends Migration
public function down(): void
{
}
}
}

View File

@@ -3,7 +3,7 @@
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use app\Models\Attribute;
use App\Models\Attribute;
class Migration_remove_duplicate_links extends Migration
{

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class Convert_to_ci4 extends Migration
{
public function up(): void
{
error_log('Migrating database to CodeIgniter4 formats');
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.4.0_ci4_conversion.sql');
error_log('Migrating to CodeIgniter4 formats completed');
}
public function down(): void
{
}
}

View File

@@ -0,0 +1,13 @@
-- creating new column of TIMESTAMP type
ALTER TABLE `ospos_sessions`
ADD COLUMN `temp_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP();
-- Use FROM_UNIXTIME() to convert from the INT timestamp to a proper datetime type
-- assigning value from old INT column to it, in hope that it will be recognized as timestamp
UPDATE `ospos_sessions` SET `temp_timestamp` = FROM_UNIXTIME(`timestamp`);
-- dropping the old INT column
ALTER TABLE `ospos_sessions` DROP COLUMN `timestamp`;
-- changing the name of the column
ALTER TABLE `ospos_sessions` CHANGE `temp_timestamp` `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP();

View File

@@ -14,6 +14,10 @@ ALTER TABLE `ospos_attribute_links` ADD UNIQUE INDEX `attribute_links_uq2` (`ite
ALTER TABLE `ospos_cash_up` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
#ospos_customers table
ALTER TABLE `ospos_customers` DROP FOREIGN KEY `ospos_customers_ibfk_1`;
ALTER TABLE `ospos_customers_points` DROP FOREIGN KEY `ospos_customers_points_ibfk_1`;
ALTER TABLE `ospos_sales` DROP FOREIGN KEY `ospos_sales_ibfk_2`;
DROP INDEX `person_id` ON `ospos_customers`;
ALTER TABLE `ospos_customers` MODIFY `taxable` tinyint(1) DEFAULT 1 NOT NULL;
ALTER TABLE `ospos_customers` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
@@ -21,6 +25,10 @@ ALTER TABLE `ospos_customers` MODIFY `discount_type` tinyint(1) DEFAULT 0 NOT NU
ALTER TABLE `ospos_customers` ADD PRIMARY KEY(`person_id`);
ALTER TABLE `ospos_customers` ADD INDEX(`company_name`);
ALTER TABLE `ospos_customers` ADD CONSTRAINT `ospos_customers_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_people`(`person_id`);
ALTER TABLE `ospos_customers_points` ADD CONSTRAINT `ospos_customers_points_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_customers` (`person_id`);
ALTER TABLE `ospos_sales` ADD CONSTRAINT `ospos_sales_ibfk_2` FOREIGN KEY (`customer_id`) REFERENCES `ospos_customers` (`person_id`);
#ospos_customers_packages table
ALTER TABLE `ospos_customers_packages` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
@@ -29,11 +37,31 @@ ALTER TABLE `ospos_dinner_tables` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL
ALTER TABLE `ospos_dinner_tables` ADD INDEX(`status`);
#ospos_employees table
ALTER TABLE `ospos_sales_payments` DROP FOREIGN KEY `ospos_sales_payments_ibfk_2`;
ALTER TABLE `ospos_sales` DROP FOREIGN KEY `ospos_sales_ibfk_1`;
ALTER TABLE `ospos_receivings` DROP FOREIGN KEY `ospos_receivings_ibfk_1`;
ALTER TABLE `ospos_inventory` DROP FOREIGN KEY `ospos_inventory_ibfk_2`;
ALTER TABLE `ospos_grants` DROP FOREIGN KEY `ospos_grants_ibfk_2`;
ALTER TABLE `ospos_expenses` DROP FOREIGN KEY `ospos_expenses_ibfk_2`;
ALTER TABLE `ospos_employees` DROP FOREIGN KEY `ospos_employees_ibfk_1`;
ALTER TABLE `ospos_cash_up` DROP FOREIGN KEY `ospos_cash_up_ibfk_1`;
ALTER TABLE `ospos_cash_up` DROP FOREIGN KEY `ospos_cash_up_ibfk_2`;
DROP INDEX `person_id` ON `ospos_employees`;
ALTER TABLE `ospos_employees` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
ALTER TABLE `ospos_employees` MODIFY `hash_version` tinyint(1) DEFAULT 2 NOT NULL;
ALTER TABLE `ospos_employees` ADD PRIMARY KEY(`person_id`);
ALTER TABLE `ospos_sales_payments` ADD CONSTRAINT `ospos_sales_payments_ibfk_2` FOREIGN KEY (`employee_id`) REFERENCES `ospos_employees` (`person_id`);
ALTER TABLE `ospos_sales` ADD CONSTRAINT `ospos_sales_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `ospos_employees` (`person_id`);
ALTER TABLE `ospos_receivings` ADD CONSTRAINT `ospos_receivings_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `ospos_employees` (`person_id`);
ALTER TABLE `ospos_inventory` ADD CONSTRAINT `ospos_inventory_ibfk_2` FOREIGN KEY (`trans_user`) REFERENCES `ospos_employees` (`person_id`);
ALTER TABLE `ospos_grants` ADD CONSTRAINT `ospos_grants_ibfk_2` foreign key (`person_id`) references `ospos_employees` (`person_id`) ON DELETE CASCADE;
ALTER TABLE `ospos_expenses` ADD CONSTRAINT `ospos_expenses_ibfk_2` FOREIGN KEY (`employee_id`) REFERENCES `ospos_employees` (`person_id`);
ALTER TABLE `ospos_employees` ADD CONSTRAINT `ospos_employees_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_people` (`person_id`);
ALTER TABLE `ospos_cash_up` ADD CONSTRAINT `ospos_cash_up_ibfk_1` FOREIGN KEY (`open_employee_id`) REFERENCES `ospos_employees` (`person_id`);
ALTER TABLE `ospos_cash_up` ADD CONSTRAINT `ospos_cash_up_ibfk_2` FOREIGN KEY (`close_employee_id`) REFERENCES `ospos_employees` (`person_id`);
#ospos_expenses table
ALTER TABLE `ospos_expenses` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
ALTER TABLE `ospos_expenses` ADD INDEX(`payment_type`);
@@ -51,7 +79,7 @@ ALTER TABLE `ospos_items` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
ALTER TABLE `ospos_items` MODIFY `stock_type` tinyint(1) DEFAULT 0 NOT NULL;
ALTER TABLE `ospos_items` MODIFY `item_type` tinyint(1) DEFAULT 0 NOT NULL;
ALTER TABLE `ospos_items` ADD INDEX(`deleted`, `item_type`);
ALTER TABLE `ospos_items` ADD INDEX(`PRIMARY`, `deleted`);
ALTER TABLE `ospos_items` ADD INDEX (`item_id`,`deleted`);
ALTER TABLE `ospos_items` ADD UNIQUE INDEX `items_uq1` (`supplier_id`, `item_id`, `deleted`, `item_type`);
#ospos_item_kits table
@@ -60,9 +88,6 @@ ALTER TABLE `ospos_item_kits` MODIFY `price_option` tinyint(1) DEFAULT 0 NOT NUL
ALTER TABLE `ospos_item_kits` MODIFY `print_option` tinyint(1) DEFAULT 0 NOT NULL;
ALTER TABLE `ospos_item_kits` ADD INDEX(`name`,`description`);
#ospos_item_quantities table
ALTER TABLE `ospos_item_quantities` ADD INDEX(`PRIMARY`,`item_id`,`location_id`);
#ospos_people table
ALTER TABLE `ospos_people` ADD INDEX(`first_name`, `last_name`, `email`, `phone_number`);
@@ -94,6 +119,11 @@ ALTER TABLE `ospos_sessions` ADD INDEX(`ip_address`);
ALTER TABLE `ospos_stock_locations` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
#ospos_suppliers table
ALTER TABLE `ospos_expenses` DROP FOREIGN KEY `ospos_expenses_ibfk_3`;
ALTER TABLE `ospos_items` DROP FOREIGN KEY `ospos_items_ibfk_1`;
ALTER TABLE `ospos_receivings` DROP FOREIGN KEY `ospos_receivings_ibfk_2`;
ALTER TABLE `ospos_suppliers` DROP FOREIGN KEY `ospos_suppliers_ibfk_1`;
DROP INDEX `person_id` ON `ospos_suppliers`;
ALTER TABLE `ospos_suppliers` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
ALTER TABLE `ospos_suppliers` MODIFY `category` tinyint(1) NOT NULL;
@@ -101,6 +131,11 @@ ALTER TABLE `ospos_suppliers` ADD PRIMARY KEY(`person_id`);
ALTER TABLE `ospos_suppliers` ADD INDEX(`category`);
ALTER TABLE `ospos_suppliers` ADD INDEX(`company_name`, `deleted`);
ALTER TABLE `ospos_expenses` ADD CONSTRAINT `ospos_expenses_ibfk_3` FOREIGN KEY (`supplier_id`) REFERENCES `ospos_suppliers` (`person_id`);
ALTER TABLE `ospos_items` ADD CONSTRAINT `ospos_items_ibfk_1` FOREIGN KEY (`supplier_id`) REFERENCES `ospos_suppliers` (`person_id`);
ALTER TABLE `ospos_receivings` ADD CONSTRAINT `ospos_receivings_ibfk_2` FOREIGN KEY (`supplier_id`) REFERENCES `ospos_suppliers` (`person_id`);
ALTER TABLE `ospos_suppliers` ADD CONSTRAINT `ospos_suppliers_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `ospos_people` (`person_id`);
#ospos_tax_categories table
ALTER TABLE `ospos_tax_categories` MODIFY `deleted` tinyint(1) DEFAULT 0 NOT NULL;
ALTER TABLE `ospos_tax_categories` MODIFY `tax_group_sequence` tinyint(1) NOT NULL;
@@ -114,4 +149,4 @@ ALTER TABLE `ospos_tax_jurisdictions` MODIFY `tax_group_sequence` tinyint(1) DEF
ALTER TABLE `ospos_tax_jurisdictions` MODIFY `cascade_sequence` tinyint(1) DEFAULT 0 NOT NULL;
#ospos_tax_rates table
ALTER TABLE `ospos_tax_rates` MODIFY `tax_rounding_code` tinyint(1) DEFAULT 0 NOT NULL;
ALTER TABLE `ospos_tax_rates` MODIFY `tax_rounding_code` tinyint(1) DEFAULT 0 NOT NULL;

Some files were not shown because too many files have changed in this diff Show More