first commit
This commit is contained in:
+127
@@ -0,0 +1,127 @@
|
|||||||
|
#-------------------------
|
||||||
|
# Operating Specific Junk Files
|
||||||
|
#-------------------------
|
||||||
|
|
||||||
|
# OS X
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# OS X Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Windows image file caches
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
# Linux
|
||||||
|
*~
|
||||||
|
|
||||||
|
# KDE directory preferences
|
||||||
|
.directory
|
||||||
|
|
||||||
|
# Linux trash folder which might appear on any partition or disk
|
||||||
|
.Trash-*
|
||||||
|
|
||||||
|
#-------------------------
|
||||||
|
# Environment Files
|
||||||
|
#-------------------------
|
||||||
|
# These should never be under version control,
|
||||||
|
# as it poses a security risk.
|
||||||
|
.env
|
||||||
|
.vagrant
|
||||||
|
Vagrantfile
|
||||||
|
|
||||||
|
#-------------------------
|
||||||
|
# Temporary Files
|
||||||
|
#-------------------------
|
||||||
|
writable/cache/*
|
||||||
|
!writable/cache/index.html
|
||||||
|
|
||||||
|
writable/logs/*
|
||||||
|
!writable/logs/index.html
|
||||||
|
|
||||||
|
writable/session/*
|
||||||
|
!writable/session/index.html
|
||||||
|
|
||||||
|
writable/uploads/*
|
||||||
|
!writable/uploads/index.html
|
||||||
|
|
||||||
|
writable/debugbar/*
|
||||||
|
|
||||||
|
php_errors.log
|
||||||
|
apache_log
|
||||||
|
#-------------------------
|
||||||
|
# User Guide Temp Files
|
||||||
|
#-------------------------
|
||||||
|
user_guide_src/build/*
|
||||||
|
user_guide_src/cilexer/build/*
|
||||||
|
user_guide_src/cilexer/dist/*
|
||||||
|
user_guide_src/cilexer/pycilexer.egg-info/*
|
||||||
|
|
||||||
|
#-------------------------
|
||||||
|
# Test Files
|
||||||
|
#-------------------------
|
||||||
|
tests/coverage*
|
||||||
|
|
||||||
|
# Don't save phpunit under version control.
|
||||||
|
phpunit
|
||||||
|
|
||||||
|
#-------------------------
|
||||||
|
# Composer
|
||||||
|
#-------------------------
|
||||||
|
vendor/
|
||||||
|
|
||||||
|
#-------------------------
|
||||||
|
# IDE / Development Files
|
||||||
|
#-------------------------
|
||||||
|
|
||||||
|
# Modules Testing
|
||||||
|
_modules/*
|
||||||
|
|
||||||
|
# phpenv local config
|
||||||
|
.php-version
|
||||||
|
|
||||||
|
# Jetbrains editors (PHPStorm, etc)
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
|
||||||
|
# Netbeans
|
||||||
|
nbproject/
|
||||||
|
build/
|
||||||
|
nbbuild/
|
||||||
|
dist/
|
||||||
|
nbdist/
|
||||||
|
nbactions.xml
|
||||||
|
nb-configuration.xml
|
||||||
|
.nb-gradle/
|
||||||
|
|
||||||
|
# Sublime Text
|
||||||
|
*.tmlanguage.cache
|
||||||
|
*.tmPreferences.cache
|
||||||
|
*.stTheme.cache
|
||||||
|
*.sublime-workspace
|
||||||
|
*.sublime-project
|
||||||
|
.phpintel
|
||||||
|
/api/
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
/results/
|
||||||
|
/phpunit*.xml
|
||||||
|
/.phpunit.*.cache
|
||||||
|
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use CodeIgniter\CodingStandard\CodeIgniter4;
|
||||||
|
use Nexus\CsConfig\Factory;
|
||||||
|
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
|
||||||
|
use Nexus\CsConfig\Fixer\Comment\SpaceAfterCommentStartFixer;
|
||||||
|
use Nexus\CsConfig\FixerGenerator;
|
||||||
|
use PhpCsFixer\Finder;
|
||||||
|
|
||||||
|
$finder = Finder::create()
|
||||||
|
->files()
|
||||||
|
->in([
|
||||||
|
__DIR__ . '/admin',
|
||||||
|
__DIR__ . '/app',
|
||||||
|
__DIR__ . '/public',
|
||||||
|
])
|
||||||
|
->notName('#Logger\.php$#')
|
||||||
|
->append([
|
||||||
|
__DIR__ . '/admin/starter/builds',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$overrides = [
|
||||||
|
'ordered_class_elements' => [
|
||||||
|
'order' => [
|
||||||
|
'use_trait',
|
||||||
|
'constant',
|
||||||
|
'property',
|
||||||
|
'method',
|
||||||
|
],
|
||||||
|
'sort_algorithm' => 'none',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$options = [
|
||||||
|
'cacheFile' => 'build/.no-header.php-cs-fixer.cache',
|
||||||
|
'finder' => $finder,
|
||||||
|
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
|
||||||
|
'customRules' => [
|
||||||
|
NoCodeSeparatorCommentFixer::name() => true,
|
||||||
|
SpaceAfterCommentStartFixer::name() => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
|
||||||
+3175
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
|||||||
|
# Contributing to CodeIgniter4
|
||||||
|
|
||||||
|
CodeIgniter is a community driven project and accepts contributions of
|
||||||
|
code and documentation from the community.
|
||||||
|
|
||||||
|
If you'd like to contribute, please read the [Contributing to CodeIgniter](./contributing/README.md).
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014-2019 British Columbia Institute of Technology
|
||||||
|
Copyright (c) 2019-2022 CodeIgniter Foundation
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
# CodeIgniter 4 Development
|
||||||
|
|
||||||
|
[](https://github.com/codeigniter4/CodeIgniter4/actions?query=workflow%3A%22PHPUnit%22)
|
||||||
|
[](https://coveralls.io/github/codeigniter4/CodeIgniter4?branch=develop)
|
||||||
|
[](https://packagist.org/packages/codeigniter4/framework)
|
||||||
|
[](https://packagist.org/packages/codeigniter4/framework)
|
||||||
|
[](https://packagist.org/packages/codeigniter4/framework)
|
||||||
|
[](https://github.com/codeigniter4/CodeIgniter4/blob/develop/LICENSE)
|
||||||
|
[](https://github.com/codeigniter4/CodeIgniter4/pulls)
|
||||||
|
<br>
|
||||||
|
|
||||||
|
## What is CodeIgniter?
|
||||||
|
|
||||||
|
CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure.
|
||||||
|
More information can be found at the [official site](http://codeigniter.com).
|
||||||
|
|
||||||
|
This repository holds the source code for CodeIgniter 4 only.
|
||||||
|
Version 4 is a complete rewrite to bring the quality and the code into a more modern version,
|
||||||
|
while still keeping as many of the things intact that has made people love the framework over the years.
|
||||||
|
|
||||||
|
More information about the plans for version 4 can be found in [the announcement](http://forum.codeigniter.com/thread-62615.html) on the forums.
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
|
||||||
|
The [User Guide](https://codeigniter4.github.io/userguide/) is the primary documentation for CodeIgniter 4.
|
||||||
|
|
||||||
|
The current **in-progress** User Guide can be found [here](https://codeigniter4.github.io/CodeIgniter4/).
|
||||||
|
As with the rest of the framework, it is a work in progress, and will see changes over time to structure, explanations, etc.
|
||||||
|
|
||||||
|
You might also be interested in the [API documentation](https://codeigniter4.github.io/api/) for the framework components.
|
||||||
|
|
||||||
|
## Important Change with index.php
|
||||||
|
|
||||||
|
index.php is no longer in the root of the project! It has been moved inside the *public* folder,
|
||||||
|
for better security and separation of components.
|
||||||
|
|
||||||
|
This means that you should configure your web server to "point" to your project's *public* folder, and
|
||||||
|
not to the project root. A better practice would be to configure a virtual host to point there. A poor practice would be to point your web server to the project root and expect to enter *public/...*, as the rest of your logic and the
|
||||||
|
framework are exposed.
|
||||||
|
|
||||||
|
**Please** read the user guide for a better explanation of how CI4 works!
|
||||||
|
|
||||||
|
## Repository Management
|
||||||
|
|
||||||
|
CodeIgniter is developed completely on a volunteer basis. As such, please give up to 7 days
|
||||||
|
for your issues to be reviewed. If you haven't heard from one of the team in that time period,
|
||||||
|
feel free to leave a comment on the issue so that it gets brought back to our attention.
|
||||||
|
|
||||||
|
We use GitHub issues to track **BUGS** and to track approved **DEVELOPMENT** work packages.
|
||||||
|
We use our [forum](http://forum.codeigniter.com) to provide SUPPORT and to discuss
|
||||||
|
FEATURE REQUESTS.
|
||||||
|
|
||||||
|
If you raise an issue here that pertains to support or a feature request, it will
|
||||||
|
be closed! If you are not sure if you have found a bug, raise a thread on the forum first -
|
||||||
|
someone else may have encountered the same thing.
|
||||||
|
|
||||||
|
Before raising a new GitHub issue, please check that your bug hasn't already
|
||||||
|
been reported or fixed.
|
||||||
|
|
||||||
|
We use pull requests (PRs) for CONTRIBUTIONS to the repository.
|
||||||
|
We are looking for contributions that address one of the reported bugs or
|
||||||
|
approved work packages.
|
||||||
|
|
||||||
|
Do not use a PR as a form of feature request.
|
||||||
|
Unsolicited contributions will only be considered if they fit nicely
|
||||||
|
into the framework roadmap.
|
||||||
|
Remember that some components that were part of CodeIgniter 3 are being moved
|
||||||
|
to optional packages, with their own repository.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
We **are** accepting contributions from the community!
|
||||||
|
|
||||||
|
Please read the [*Contributing to CodeIgniter*](https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/README.md).
|
||||||
|
|
||||||
|
## Server Requirements
|
||||||
|
|
||||||
|
PHP version 7.3 or higher is required, with the following extensions installed:
|
||||||
|
|
||||||
|
|
||||||
|
- [intl](http://php.net/manual/en/intl.requirements.php)
|
||||||
|
- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library
|
||||||
|
- [mbstring](http://php.net/manual/en/mbstring.installation.php)
|
||||||
|
|
||||||
|
Additionally, make sure that the following extensions are enabled in your PHP:
|
||||||
|
|
||||||
|
- json (enabled by default - don't turn it off)
|
||||||
|
- xml (enabled by default - don't turn it off)
|
||||||
|
- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php)
|
||||||
|
|
||||||
|
## Running CodeIgniter Tests
|
||||||
|
|
||||||
|
Information on running the CodeIgniter test suite can be found in the [README.md](tests/README.md) file in the tests directory.
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
The development team and community take all security issues seriously. **Please do not make public any uncovered flaws.**
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
Thank you for improving the security of our code! Any assistance in removing security flaws will be acknowledged.
|
||||||
|
|
||||||
|
**Please report security flaws by emailing the development team directly: security@codeigniter.com**.
|
||||||
|
|
||||||
|
The lead maintainer will acknowledge your email within 48 hours, and will send a more detailed response within 48 hours indicating
|
||||||
|
the next steps in handling your report. After the initial reply to your report, the security team will endeavor to keep you informed of the
|
||||||
|
progress towards a fix and full announcement, and may ask for additional information or guidance.
|
||||||
|
|
||||||
|
## Disclosure Policy
|
||||||
|
|
||||||
|
When the security team receives a security bug report, they will assign it to a primary handler.
|
||||||
|
This person will coordinate the fix and release process, involving the following steps:
|
||||||
|
|
||||||
|
- Confirm the problem and determine the affected versions.
|
||||||
|
- Audit code to find any potential similar problems.
|
||||||
|
- Prepare fixes for all releases still under maintenance. These fixes will be released as fast as possible.
|
||||||
|
- Publish security advisories at https://github.com/codeigniter4/CodeIgniter4/security/advisories
|
||||||
|
|
||||||
|
## Comments on this Policy
|
||||||
|
|
||||||
|
If you have suggestions on how this process could be improved please submit a Pull Request.
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<IfModule authz_core_module>
|
||||||
|
Require all denied
|
||||||
|
</IfModule>
|
||||||
|
<IfModule !authz_core_module>
|
||||||
|
Deny from all
|
||||||
|
</IfModule>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* @see: https://codeigniter4.github.io/CodeIgniter4/
|
||||||
|
*/
|
||||||
@@ -0,0 +1,464 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class App extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Base Site URL
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* URL to your CodeIgniter root. Typically this will be your base URL,
|
||||||
|
* WITH a trailing slash:
|
||||||
|
*
|
||||||
|
* http://example.com/
|
||||||
|
*
|
||||||
|
* If this is not set then CodeIgniter will try guess the protocol, domain
|
||||||
|
* 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 = 'http://localhost:8080/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 = 'index.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 bool
|
||||||
|
*/
|
||||||
|
public $negotiateLocale = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Supported Locales
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* If $negotiateLocale is true, this array lists the locales supported
|
||||||
|
* by the application in descending order of priority. If no match is
|
||||||
|
* found, the first locale will be used.
|
||||||
|
*
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
public $supportedLocales = ['en'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 = 'America/Chicago';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 bool
|
||||||
|
*/
|
||||||
|
public $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\FileHandler';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Session Cookie Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The session cookie name, must contain only [0-9a-z_-] characters
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $sessionCookieName = 'ci_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 int
|
||||||
|
*/
|
||||||
|
public $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 = WRITEPATH . 'session';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 bool
|
||||||
|
*/
|
||||||
|
public $sessionMatchIP = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Session Time to Update
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* How many seconds between CI regenerating the session ID.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $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 bool
|
||||||
|
*/
|
||||||
|
public $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 = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Domain
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Set to `.your-domain.com` for site-wide cookies.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @deprecated use Config\Cookie::$domain property instead.
|
||||||
|
*/
|
||||||
|
public $cookieDomain = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Path
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Typically will be a forward slash.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @deprecated use Config\Cookie::$path property instead.
|
||||||
|
*/
|
||||||
|
public $cookiePath = '/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Secure
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Cookie will only be set if a secure HTTPS connection exists.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @deprecated use Config\Cookie::$secure property instead.
|
||||||
|
*/
|
||||||
|
public $cookieSecure = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie HttpOnly
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Cookie will only be accessible via HTTP(S) (no JavaScript).
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @deprecated use Config\Cookie::$httponly property instead.
|
||||||
|
*/
|
||||||
|
public $cookieHTTPOnly = 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`, `$cookieSecure` must also be set.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @deprecated use Config\Cookie::$samesite property instead.
|
||||||
|
*/
|
||||||
|
public $cookieSameSite = 'Lax';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Token Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The token name.
|
||||||
|
*
|
||||||
|
* @deprecated Use `Config\Security` $tokenName property instead of using this property.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $CSRFTokenName = 'csrf_test_name';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 Cookie Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The cookie name.
|
||||||
|
*
|
||||||
|
* @deprecated Use `Config\Security` $cookieName property instead of using this property.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $CSRFCookieName = 'csrf_cookie_name';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Expire
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The number in seconds the token should expire.
|
||||||
|
*
|
||||||
|
* @deprecated Use `Config\Security` $expire property instead of using this property.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $CSRFExpire = 7200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Regenerate
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Regenerate token on every submission?
|
||||||
|
*
|
||||||
|
* @deprecated Use `Config\Security` $regenerate property instead of using this property.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $CSRFRegenerate = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Redirect
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Redirect to previous page with error on failure?
|
||||||
|
*
|
||||||
|
* @deprecated Use `Config\Security` $redirect property instead of using this property.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $CSRFRedirect = 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Content Security Policy
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Enables the Response's Content Secure Policy to restrict the sources that
|
||||||
|
* can be used for images, scripts, CSS files, audio, video, etc. If enabled,
|
||||||
|
* the Response object will populate default values for the policy from the
|
||||||
|
* `ContentSecurityPolicy.php` file. Controllers can always add to those
|
||||||
|
* restrictions at run time.
|
||||||
|
*
|
||||||
|
* For a better understanding of CSP, see these documents:
|
||||||
|
*
|
||||||
|
* @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/
|
||||||
|
* @see http://www.w3.org/TR/CSP/
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $CSPEnabled = false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\AutoloadConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* AUTOLOADER CONFIGURATION
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This file defines the namespaces and class maps so the Autoloader
|
||||||
|
* can find the files as needed.
|
||||||
|
*
|
||||||
|
* NOTE: If you use an identical key in $psr4 or $classmap, then
|
||||||
|
* the values in this file will overwrite the framework's values.
|
||||||
|
*/
|
||||||
|
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',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* 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 = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* 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 = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| ERROR DISPLAY
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| In development, we want to show as many errors as possible to help
|
||||||
|
| make sure they don't make it to production. And save us hours of
|
||||||
|
| painful debugging.
|
||||||
|
*/
|
||||||
|
error_reporting(-1);
|
||||||
|
ini_set('display_errors', '1');
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DEBUG BACKTRACES
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| If true, this constant will tell the error screens to display debug
|
||||||
|
| backtraces along with the other error information. If you would
|
||||||
|
| prefer to not see this, set this value to false.
|
||||||
|
*/
|
||||||
|
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DEBUG MODE
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Debug mode is an experimental flag that can allow changes throughout
|
||||||
|
| the system. This will control whether Kint is loaded, and a few other
|
||||||
|
| items. It can always be used within your own application too.
|
||||||
|
*/
|
||||||
|
defined('CI_DEBUG') || define('CI_DEBUG', true);
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| ERROR DISPLAY
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Don't show ANY in production environments. Instead, let the system catch
|
||||||
|
| it and display a generic error message.
|
||||||
|
*/
|
||||||
|
ini_set('display_errors', '0');
|
||||||
|
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DEBUG MODE
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Debug mode is an experimental flag that can allow changes throughout
|
||||||
|
| the system. It's not widely used currently, and may not survive
|
||||||
|
| release of the framework.
|
||||||
|
*/
|
||||||
|
defined('CI_DEBUG') || define('CI_DEBUG', false);
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| ERROR DISPLAY
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| In development, we want to show as many errors as possible to help
|
||||||
|
| make sure they don't make it to production. And save us hours of
|
||||||
|
| painful debugging.
|
||||||
|
*/
|
||||||
|
error_reporting(-1);
|
||||||
|
ini_set('display_errors', '1');
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DEBUG BACKTRACES
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| If true, this constant will tell the error screens to display debug
|
||||||
|
| backtraces along with the other error information. If you would
|
||||||
|
| prefer to not see this, set this value to false.
|
||||||
|
*/
|
||||||
|
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DEBUG MODE
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Debug mode is an experimental flag that can allow changes throughout
|
||||||
|
| the system. It's not widely used currently, and may not survive
|
||||||
|
| release of the framework.
|
||||||
|
*/
|
||||||
|
defined('CI_DEBUG') || define('CI_DEBUG', true);
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?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.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $shareOptions = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Cache\Handlers\DummyHandler;
|
||||||
|
use CodeIgniter\Cache\Handlers\FileHandler;
|
||||||
|
use CodeIgniter\Cache\Handlers\MemcachedHandler;
|
||||||
|
use CodeIgniter\Cache\Handlers\PredisHandler;
|
||||||
|
use CodeIgniter\Cache\Handlers\RedisHandler;
|
||||||
|
use CodeIgniter\Cache\Handlers\WincacheHandler;
|
||||||
|
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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 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 = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 int
|
||||||
|
*/
|
||||||
|
public $ttl = 60;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $reservedCharacters = '{}()/\@:';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* File settings
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Your file storage preferences can be specified below, if you are using
|
||||||
|
* the File driver.
|
||||||
|
*
|
||||||
|
* @var array<string, int|string|null>
|
||||||
|
*/
|
||||||
|
public $file = [
|
||||||
|
'storePath' => WRITEPATH . 'cache/',
|
||||||
|
'mode' => 0640,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
* 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, boolean|int|string>
|
||||||
|
*/
|
||||||
|
public $memcached = [
|
||||||
|
'host' => '127.0.0.1',
|
||||||
|
'port' => 11211,
|
||||||
|
'weight' => 1,
|
||||||
|
'raw' => false,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
* 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 $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 $validHandlers = [
|
||||||
|
'dummy' => DummyHandler::class,
|
||||||
|
'file' => FileHandler::class,
|
||||||
|
'memcached' => MemcachedHandler::class,
|
||||||
|
'predis' => PredisHandler::class,
|
||||||
|
'redis' => RedisHandler::class,
|
||||||
|
'wincache' => WincacheHandler::class,
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<?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.
|
||||||
|
*/
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
|
||||||
|
/*
|
||||||
|
| --------------------------------------------------------------------------
|
||||||
|
| 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
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the default settings for the ContentSecurityPolicy, if you
|
||||||
|
* choose to use it. The values here will be read in and set as defaults
|
||||||
|
* for the site. If needed, they can be overridden on a page-by-page basis.
|
||||||
|
*
|
||||||
|
* Suggested reference for explanations:
|
||||||
|
*
|
||||||
|
* @see https://www.html5rocks.com/en/tutorials/security/content-security-policy/
|
||||||
|
*/
|
||||||
|
class ContentSecurityPolicy extends BaseConfig
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
// Broadbrush CSP management
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default CSP report context
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $reportOnly = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies a URL where a browser will send reports
|
||||||
|
* when a content security policy is violated.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
public $reportURI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 bool
|
||||||
|
*/
|
||||||
|
public $upgradeInsecureRequests = false;
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists allowed scripts' URLs.
|
||||||
|
*
|
||||||
|
* @var string|string[]
|
||||||
|
*/
|
||||||
|
public $scriptSrc = '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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows control over Flash and other plugins.
|
||||||
|
*
|
||||||
|
* @var string|string[]
|
||||||
|
*/
|
||||||
|
public $objectSrc = 'self';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string|string[]|null
|
||||||
|
*/
|
||||||
|
public $manifestSrc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use DateTimeInterface;
|
||||||
|
|
||||||
|
class Cookie extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Prefix
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Set a cookie name prefix if you need to avoid collisions.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $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|int|string
|
||||||
|
*/
|
||||||
|
public $expires = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Path
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Typically will be a forward slash.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $path = '/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Domain
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Set to `.your-domain.com` for site-wide cookies.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $domain = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Secure
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Cookie will only be set if a secure HTTPS connection exists.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $secure = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie HTTPOnly
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Cookie will only be accessible via HTTP(S) (no JavaScript).
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $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 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 bool
|
||||||
|
*
|
||||||
|
* @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;
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Database\Config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database Configuration
|
||||||
|
*/
|
||||||
|
class Database extends Config
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The directory that holds the Migrations
|
||||||
|
* and Seeds directories.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lets you choose which connection group to
|
||||||
|
* use if no other is specified.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $defaultGroup = 'default';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default database connection.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $default = [
|
||||||
|
'DSN' => '',
|
||||||
|
'hostname' => 'localhost',
|
||||||
|
'username' => '',
|
||||||
|
'password' => '',
|
||||||
|
'database' => '',
|
||||||
|
'DBDriver' => 'MySQLi',
|
||||||
|
'DBPrefix' => '',
|
||||||
|
'pConnect' => false,
|
||||||
|
'DBDebug' => (ENVIRONMENT !== 'production'),
|
||||||
|
'charset' => 'utf8',
|
||||||
|
'DBCollat' => 'utf8_general_ci',
|
||||||
|
'swapPre' => '',
|
||||||
|
'encrypt' => false,
|
||||||
|
'compress' => false,
|
||||||
|
'strictOn' => false,
|
||||||
|
'failover' => [],
|
||||||
|
'port' => 3306,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This database connection is used when
|
||||||
|
* running PHPUnit database tests.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $tests = [
|
||||||
|
'DSN' => '',
|
||||||
|
'hostname' => '127.0.0.1',
|
||||||
|
'username' => '',
|
||||||
|
'password' => '',
|
||||||
|
'database' => ':memory:',
|
||||||
|
'DBDriver' => 'SQLite3',
|
||||||
|
'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
|
||||||
|
'pConnect' => false,
|
||||||
|
'DBDebug' => (ENVIRONMENT !== 'production'),
|
||||||
|
'charset' => 'utf8',
|
||||||
|
'DBCollat' => 'utf8_general_ci',
|
||||||
|
'swapPre' => '',
|
||||||
|
'encrypt' => false,
|
||||||
|
'compress' => false,
|
||||||
|
'strictOn' => false,
|
||||||
|
'failover' => [],
|
||||||
|
'port' => 3306,
|
||||||
|
];
|
||||||
|
|
||||||
|
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.
|
||||||
|
if (ENVIRONMENT === 'testing') {
|
||||||
|
$this->defaultGroup = 'tests';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
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">',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class Email extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $fromEmail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $fromName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $recipients;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The "user agent"
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $userAgent = 'CodeIgniter';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The mail sending protocol: mail, sendmail, smtp
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $protocol = 'mail';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The server path to Sendmail.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $mailPath = '/usr/sbin/sendmail';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMTP Server Address
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $SMTPHost;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMTP Username
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $SMTPUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMTP Password
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $SMTPPass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMTP Port
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $SMTPPort = 25;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMTP Timeout (in seconds)
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $SMTPTimeout = 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable persistent SMTP connections
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $SMTPKeepAlive = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMTP Encryption. Either tls or ssl
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $SMTPCrypto = 'tls';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable word-wrap
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $wordWrap = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Character count to wrap at
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $wrapChars = 76;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of mail, either 'text' or 'html'
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $mailType = 'text';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Character set (utf-8, iso-8859-1, etc.)
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $charset = 'UTF-8';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to validate the email address
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $validate = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email Priority. 1 = highest. 5 = lowest. 3 = normal
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $priority = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Newline character. (Use “\r\n” to comply with RFC 822)
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $CRLF = "\r\n";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Newline character. (Use “\r\n” to comply with RFC 822)
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $newline = "\r\n";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable BCC Batch Mode.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $BCCBatchMode = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of emails in each BCC batch
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $BCCBatchSize = 200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable notify message from server
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $DSN = false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encryption configuration.
|
||||||
|
*
|
||||||
|
* These are the settings used for encryption, if you don't pass a parameter
|
||||||
|
* array to the encrypter for creation/initialization.
|
||||||
|
*/
|
||||||
|
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 = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Encryption Driver to Use
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* One of the supported encryption drivers.
|
||||||
|
*
|
||||||
|
* Available drivers:
|
||||||
|
* - OpenSSL
|
||||||
|
* - Sodium
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $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 int
|
||||||
|
*/
|
||||||
|
public $blockSize = 16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Encryption digest
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $digest = 'SHA512';
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Events\Events;
|
||||||
|
use CodeIgniter\Exceptions\FrameworkException;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* Application Events
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* Events allow you to tap into the execution of the program without
|
||||||
|
* modifying or extending core files. This file provides a central
|
||||||
|
* location to define your events, though they can always be added
|
||||||
|
* at run-time, also, if needed.
|
||||||
|
*
|
||||||
|
* You create code that can execute by subscribing to events with
|
||||||
|
* the 'on()' method. This accepts any form of callable, including
|
||||||
|
* Closures, that will be executed when the event is triggered.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* Events::on('create', [$myInstance, 'myMethod']);
|
||||||
|
*/
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
ob_start(static function ($buffer) {
|
||||||
|
return $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();
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 bool
|
||||||
|
*/
|
||||||
|
public $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];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?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()
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $multipleFilters = false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
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,
|
||||||
|
'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',
|
||||||
|
// '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 should run on any
|
||||||
|
* before or after URI patterns.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $filters = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\ForeignCharacters as BaseForeignCharacters;
|
||||||
|
|
||||||
|
class ForeignCharacters extends BaseForeignCharacters
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use CodeIgniter\Format\FormatterInterface;
|
||||||
|
|
||||||
|
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
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 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,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
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: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',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class Honeypot extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Makes Honeypot visible or not to human
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $hidden = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Honeypot Label Content
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $label = 'Fill This Field';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Honeypot Field Name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $name = 'honeypot';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Honeypot HTML Template
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $template = '<label>{label}</label><input type="text" name="{name}" value=""/>';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Honeypot container
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $container = '<div style="display:none">{template}</div>';
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use CodeIgniter\Images\Handlers\GDHandler;
|
||||||
|
use CodeIgniter\Images\Handlers\ImageMagickHandler;
|
||||||
|
|
||||||
|
class Images extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Default handler used if no other handler is specified.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $defaultHandler = 'gd';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The path to the image library.
|
||||||
|
* Required for ImageMagick, GraphicsMagick, or NetPBM.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $libraryPath = '/usr/local/bin/convert';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The available handler classes.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public $handlers = [
|
||||||
|
'gd' => GDHandler::class,
|
||||||
|
'imagick' => ImageMagickHandler::class,
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use Kint\Renderer\Renderer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Kint
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* We use Kint's `RichRenderer` and `CLIRenderer`. This area contains options
|
||||||
|
* that you can set to customize how Kint works for you.
|
||||||
|
*
|
||||||
|
* @see https://kint-php.github.io/kint/ for details on these settings.
|
||||||
|
*/
|
||||||
|
class Kint extends BaseConfig
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Global Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
public $plugins;
|
||||||
|
public $maxDepth = 6;
|
||||||
|
public $displayCalledFrom = true;
|
||||||
|
public $expanded = false;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| RichRenderer Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
public $richTheme = 'aante-light.css';
|
||||||
|
public $richFolder = false;
|
||||||
|
public $richSort = Renderer::SORT_FULL;
|
||||||
|
public $richObjectPlugins;
|
||||||
|
public $richTabPlugins;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| CLI Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
public $cliColors = true;
|
||||||
|
public $cliForceUTF8 = false;
|
||||||
|
public $cliDetectWidth = true;
|
||||||
|
public $cliMinWidth = 40;
|
||||||
|
}
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
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
|
||||||
|
*
|
||||||
|
* 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 = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 = [
|
||||||
|
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* File Handler
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
'CodeIgniter\Log\Handlers\FileHandler' => [
|
||||||
|
|
||||||
|
// 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 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' => 0644,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 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,
|
||||||
|
// ],
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
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 bool
|
||||||
|
*/
|
||||||
|
public $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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 = 'Y-m-d-His_';
|
||||||
|
}
|
||||||
@@ -0,0 +1,534 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mimes
|
||||||
|
*
|
||||||
|
* This file contains an array of mime types. It is used by the
|
||||||
|
* Upload class to help identify allowed file types.
|
||||||
|
*
|
||||||
|
* When more than one variation for an extension exist (like jpg, jpeg, etc)
|
||||||
|
* the most common one should be first in the array to aid the guess*
|
||||||
|
* methods. The same applies when more than one mime-type exists for a
|
||||||
|
* single extension.
|
||||||
|
*
|
||||||
|
* When working with mime types, please make sure you have the ´fileinfo´
|
||||||
|
* extension enabled to reliably detect the media types.
|
||||||
|
*/
|
||||||
|
class Mimes
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Map of extensions to mime types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $mimes = [
|
||||||
|
'hqx' => [
|
||||||
|
'application/mac-binhex40',
|
||||||
|
'application/mac-binhex',
|
||||||
|
'application/x-binhex40',
|
||||||
|
'application/x-mac-binhex40',
|
||||||
|
],
|
||||||
|
'cpt' => 'application/mac-compactpro',
|
||||||
|
'csv' => [
|
||||||
|
'text/csv',
|
||||||
|
'text/x-comma-separated-values',
|
||||||
|
'text/comma-separated-values',
|
||||||
|
'application/vnd.ms-excel',
|
||||||
|
'application/x-csv',
|
||||||
|
'text/x-csv',
|
||||||
|
'application/csv',
|
||||||
|
'application/excel',
|
||||||
|
'application/vnd.msexcel',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'bin' => [
|
||||||
|
'application/macbinary',
|
||||||
|
'application/mac-binary',
|
||||||
|
'application/octet-stream',
|
||||||
|
'application/x-binary',
|
||||||
|
'application/x-macbinary',
|
||||||
|
],
|
||||||
|
'dms' => 'application/octet-stream',
|
||||||
|
'lha' => 'application/octet-stream',
|
||||||
|
'lzh' => 'application/octet-stream',
|
||||||
|
'exe' => [
|
||||||
|
'application/octet-stream',
|
||||||
|
'application/x-msdownload',
|
||||||
|
],
|
||||||
|
'class' => 'application/octet-stream',
|
||||||
|
'psd' => [
|
||||||
|
'application/x-photoshop',
|
||||||
|
'image/vnd.adobe.photoshop',
|
||||||
|
],
|
||||||
|
'so' => 'application/octet-stream',
|
||||||
|
'sea' => 'application/octet-stream',
|
||||||
|
'dll' => 'application/octet-stream',
|
||||||
|
'oda' => 'application/oda',
|
||||||
|
'pdf' => [
|
||||||
|
'application/pdf',
|
||||||
|
'application/force-download',
|
||||||
|
'application/x-download',
|
||||||
|
],
|
||||||
|
'ai' => [
|
||||||
|
'application/pdf',
|
||||||
|
'application/postscript',
|
||||||
|
],
|
||||||
|
'eps' => 'application/postscript',
|
||||||
|
'ps' => 'application/postscript',
|
||||||
|
'smi' => 'application/smil',
|
||||||
|
'smil' => 'application/smil',
|
||||||
|
'mif' => 'application/vnd.mif',
|
||||||
|
'xls' => [
|
||||||
|
'application/vnd.ms-excel',
|
||||||
|
'application/msexcel',
|
||||||
|
'application/x-msexcel',
|
||||||
|
'application/x-ms-excel',
|
||||||
|
'application/x-excel',
|
||||||
|
'application/x-dos_ms_excel',
|
||||||
|
'application/xls',
|
||||||
|
'application/x-xls',
|
||||||
|
'application/excel',
|
||||||
|
'application/download',
|
||||||
|
'application/vnd.ms-office',
|
||||||
|
'application/msword',
|
||||||
|
],
|
||||||
|
'ppt' => [
|
||||||
|
'application/vnd.ms-powerpoint',
|
||||||
|
'application/powerpoint',
|
||||||
|
'application/vnd.ms-office',
|
||||||
|
'application/msword',
|
||||||
|
],
|
||||||
|
'pptx' => [
|
||||||
|
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||||
|
'application/x-zip',
|
||||||
|
'application/zip',
|
||||||
|
],
|
||||||
|
'wbxml' => 'application/wbxml',
|
||||||
|
'wmlc' => 'application/wmlc',
|
||||||
|
'dcr' => 'application/x-director',
|
||||||
|
'dir' => 'application/x-director',
|
||||||
|
'dxr' => 'application/x-director',
|
||||||
|
'dvi' => 'application/x-dvi',
|
||||||
|
'gtar' => 'application/x-gtar',
|
||||||
|
'gz' => 'application/x-gzip',
|
||||||
|
'gzip' => 'application/x-gzip',
|
||||||
|
'php' => [
|
||||||
|
'application/x-php',
|
||||||
|
'application/x-httpd-php',
|
||||||
|
'application/php',
|
||||||
|
'text/php',
|
||||||
|
'text/x-php',
|
||||||
|
'application/x-httpd-php-source',
|
||||||
|
],
|
||||||
|
'php4' => 'application/x-httpd-php',
|
||||||
|
'php3' => 'application/x-httpd-php',
|
||||||
|
'phtml' => 'application/x-httpd-php',
|
||||||
|
'phps' => 'application/x-httpd-php-source',
|
||||||
|
'js' => [
|
||||||
|
'application/x-javascript',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'swf' => 'application/x-shockwave-flash',
|
||||||
|
'sit' => 'application/x-stuffit',
|
||||||
|
'tar' => 'application/x-tar',
|
||||||
|
'tgz' => [
|
||||||
|
'application/x-tar',
|
||||||
|
'application/x-gzip-compressed',
|
||||||
|
],
|
||||||
|
'z' => 'application/x-compress',
|
||||||
|
'xhtml' => 'application/xhtml+xml',
|
||||||
|
'xht' => 'application/xhtml+xml',
|
||||||
|
'zip' => [
|
||||||
|
'application/x-zip',
|
||||||
|
'application/zip',
|
||||||
|
'application/x-zip-compressed',
|
||||||
|
'application/s-compressed',
|
||||||
|
'multipart/x-zip',
|
||||||
|
],
|
||||||
|
'rar' => [
|
||||||
|
'application/vnd.rar',
|
||||||
|
'application/x-rar',
|
||||||
|
'application/rar',
|
||||||
|
'application/x-rar-compressed',
|
||||||
|
],
|
||||||
|
'mid' => 'audio/midi',
|
||||||
|
'midi' => 'audio/midi',
|
||||||
|
'mpga' => 'audio/mpeg',
|
||||||
|
'mp2' => 'audio/mpeg',
|
||||||
|
'mp3' => [
|
||||||
|
'audio/mpeg',
|
||||||
|
'audio/mpg',
|
||||||
|
'audio/mpeg3',
|
||||||
|
'audio/mp3',
|
||||||
|
],
|
||||||
|
'aif' => [
|
||||||
|
'audio/x-aiff',
|
||||||
|
'audio/aiff',
|
||||||
|
],
|
||||||
|
'aiff' => [
|
||||||
|
'audio/x-aiff',
|
||||||
|
'audio/aiff',
|
||||||
|
],
|
||||||
|
'aifc' => 'audio/x-aiff',
|
||||||
|
'ram' => 'audio/x-pn-realaudio',
|
||||||
|
'rm' => 'audio/x-pn-realaudio',
|
||||||
|
'rpm' => 'audio/x-pn-realaudio-plugin',
|
||||||
|
'ra' => 'audio/x-realaudio',
|
||||||
|
'rv' => 'video/vnd.rn-realvideo',
|
||||||
|
'wav' => [
|
||||||
|
'audio/x-wav',
|
||||||
|
'audio/wave',
|
||||||
|
'audio/wav',
|
||||||
|
],
|
||||||
|
'bmp' => [
|
||||||
|
'image/bmp',
|
||||||
|
'image/x-bmp',
|
||||||
|
'image/x-bitmap',
|
||||||
|
'image/x-xbitmap',
|
||||||
|
'image/x-win-bitmap',
|
||||||
|
'image/x-windows-bmp',
|
||||||
|
'image/ms-bmp',
|
||||||
|
'image/x-ms-bmp',
|
||||||
|
'application/bmp',
|
||||||
|
'application/x-bmp',
|
||||||
|
'application/x-win-bitmap',
|
||||||
|
],
|
||||||
|
'gif' => 'image/gif',
|
||||||
|
'jpg' => [
|
||||||
|
'image/jpeg',
|
||||||
|
'image/pjpeg',
|
||||||
|
],
|
||||||
|
'jpeg' => [
|
||||||
|
'image/jpeg',
|
||||||
|
'image/pjpeg',
|
||||||
|
],
|
||||||
|
'jpe' => [
|
||||||
|
'image/jpeg',
|
||||||
|
'image/pjpeg',
|
||||||
|
],
|
||||||
|
'jp2' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'j2k' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'jpf' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'jpg2' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'jpx' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'jpm' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'mj2' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'mjp2' => [
|
||||||
|
'image/jp2',
|
||||||
|
'video/mj2',
|
||||||
|
'image/jpx',
|
||||||
|
'image/jpm',
|
||||||
|
],
|
||||||
|
'png' => [
|
||||||
|
'image/png',
|
||||||
|
'image/x-png',
|
||||||
|
],
|
||||||
|
'tif' => 'image/tiff',
|
||||||
|
'tiff' => 'image/tiff',
|
||||||
|
'css' => [
|
||||||
|
'text/css',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'html' => [
|
||||||
|
'text/html',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'htm' => [
|
||||||
|
'text/html',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'shtml' => [
|
||||||
|
'text/html',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'txt' => 'text/plain',
|
||||||
|
'text' => 'text/plain',
|
||||||
|
'log' => [
|
||||||
|
'text/plain',
|
||||||
|
'text/x-log',
|
||||||
|
],
|
||||||
|
'rtx' => 'text/richtext',
|
||||||
|
'rtf' => 'text/rtf',
|
||||||
|
'xml' => [
|
||||||
|
'application/xml',
|
||||||
|
'text/xml',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'xsl' => [
|
||||||
|
'application/xml',
|
||||||
|
'text/xsl',
|
||||||
|
'text/xml',
|
||||||
|
],
|
||||||
|
'mpeg' => 'video/mpeg',
|
||||||
|
'mpg' => 'video/mpeg',
|
||||||
|
'mpe' => 'video/mpeg',
|
||||||
|
'qt' => 'video/quicktime',
|
||||||
|
'mov' => 'video/quicktime',
|
||||||
|
'avi' => [
|
||||||
|
'video/x-msvideo',
|
||||||
|
'video/msvideo',
|
||||||
|
'video/avi',
|
||||||
|
'application/x-troff-msvideo',
|
||||||
|
],
|
||||||
|
'movie' => 'video/x-sgi-movie',
|
||||||
|
'doc' => [
|
||||||
|
'application/msword',
|
||||||
|
'application/vnd.ms-office',
|
||||||
|
],
|
||||||
|
'docx' => [
|
||||||
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||||
|
'application/zip',
|
||||||
|
'application/msword',
|
||||||
|
'application/x-zip',
|
||||||
|
],
|
||||||
|
'dot' => [
|
||||||
|
'application/msword',
|
||||||
|
'application/vnd.ms-office',
|
||||||
|
],
|
||||||
|
'dotx' => [
|
||||||
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||||
|
'application/zip',
|
||||||
|
'application/msword',
|
||||||
|
],
|
||||||
|
'xlsx' => [
|
||||||
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||||
|
'application/zip',
|
||||||
|
'application/vnd.ms-excel',
|
||||||
|
'application/msword',
|
||||||
|
'application/x-zip',
|
||||||
|
],
|
||||||
|
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
|
||||||
|
'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
|
||||||
|
'word' => [
|
||||||
|
'application/msword',
|
||||||
|
'application/octet-stream',
|
||||||
|
],
|
||||||
|
'xl' => 'application/excel',
|
||||||
|
'eml' => 'message/rfc822',
|
||||||
|
'json' => [
|
||||||
|
'application/json',
|
||||||
|
'text/json',
|
||||||
|
],
|
||||||
|
'pem' => [
|
||||||
|
'application/x-x509-user-cert',
|
||||||
|
'application/x-pem-file',
|
||||||
|
'application/octet-stream',
|
||||||
|
],
|
||||||
|
'p10' => [
|
||||||
|
'application/x-pkcs10',
|
||||||
|
'application/pkcs10',
|
||||||
|
],
|
||||||
|
'p12' => 'application/x-pkcs12',
|
||||||
|
'p7a' => 'application/x-pkcs7-signature',
|
||||||
|
'p7c' => [
|
||||||
|
'application/pkcs7-mime',
|
||||||
|
'application/x-pkcs7-mime',
|
||||||
|
],
|
||||||
|
'p7m' => [
|
||||||
|
'application/pkcs7-mime',
|
||||||
|
'application/x-pkcs7-mime',
|
||||||
|
],
|
||||||
|
'p7r' => 'application/x-pkcs7-certreqresp',
|
||||||
|
'p7s' => 'application/pkcs7-signature',
|
||||||
|
'crt' => [
|
||||||
|
'application/x-x509-ca-cert',
|
||||||
|
'application/x-x509-user-cert',
|
||||||
|
'application/pkix-cert',
|
||||||
|
],
|
||||||
|
'crl' => [
|
||||||
|
'application/pkix-crl',
|
||||||
|
'application/pkcs-crl',
|
||||||
|
],
|
||||||
|
'der' => 'application/x-x509-ca-cert',
|
||||||
|
'kdb' => 'application/octet-stream',
|
||||||
|
'pgp' => 'application/pgp',
|
||||||
|
'gpg' => 'application/gpg-keys',
|
||||||
|
'sst' => 'application/octet-stream',
|
||||||
|
'csr' => 'application/octet-stream',
|
||||||
|
'rsa' => 'application/x-pkcs7',
|
||||||
|
'cer' => [
|
||||||
|
'application/pkix-cert',
|
||||||
|
'application/x-x509-ca-cert',
|
||||||
|
],
|
||||||
|
'3g2' => 'video/3gpp2',
|
||||||
|
'3gp' => [
|
||||||
|
'video/3gp',
|
||||||
|
'video/3gpp',
|
||||||
|
],
|
||||||
|
'mp4' => 'video/mp4',
|
||||||
|
'm4a' => 'audio/x-m4a',
|
||||||
|
'f4v' => [
|
||||||
|
'video/mp4',
|
||||||
|
'video/x-f4v',
|
||||||
|
],
|
||||||
|
'flv' => 'video/x-flv',
|
||||||
|
'webm' => 'video/webm',
|
||||||
|
'aac' => 'audio/x-acc',
|
||||||
|
'm4u' => 'application/vnd.mpegurl',
|
||||||
|
'm3u' => 'text/plain',
|
||||||
|
'xspf' => 'application/xspf+xml',
|
||||||
|
'vlc' => 'application/videolan',
|
||||||
|
'wmv' => [
|
||||||
|
'video/x-ms-wmv',
|
||||||
|
'video/x-ms-asf',
|
||||||
|
],
|
||||||
|
'au' => 'audio/x-au',
|
||||||
|
'ac3' => 'audio/ac3',
|
||||||
|
'flac' => 'audio/x-flac',
|
||||||
|
'ogg' => [
|
||||||
|
'audio/ogg',
|
||||||
|
'video/ogg',
|
||||||
|
'application/ogg',
|
||||||
|
],
|
||||||
|
'kmz' => [
|
||||||
|
'application/vnd.google-earth.kmz',
|
||||||
|
'application/zip',
|
||||||
|
'application/x-zip',
|
||||||
|
],
|
||||||
|
'kml' => [
|
||||||
|
'application/vnd.google-earth.kml+xml',
|
||||||
|
'application/xml',
|
||||||
|
'text/xml',
|
||||||
|
],
|
||||||
|
'ics' => 'text/calendar',
|
||||||
|
'ical' => 'text/calendar',
|
||||||
|
'zsh' => 'text/x-scriptzsh',
|
||||||
|
'7zip' => [
|
||||||
|
'application/x-compressed',
|
||||||
|
'application/x-zip-compressed',
|
||||||
|
'application/zip',
|
||||||
|
'multipart/x-zip',
|
||||||
|
],
|
||||||
|
'cdr' => [
|
||||||
|
'application/cdr',
|
||||||
|
'application/coreldraw',
|
||||||
|
'application/x-cdr',
|
||||||
|
'application/x-coreldraw',
|
||||||
|
'image/cdr',
|
||||||
|
'image/x-cdr',
|
||||||
|
'zz-application/zz-winassoc-cdr',
|
||||||
|
],
|
||||||
|
'wma' => [
|
||||||
|
'audio/x-ms-wma',
|
||||||
|
'video/x-ms-asf',
|
||||||
|
],
|
||||||
|
'jar' => [
|
||||||
|
'application/java-archive',
|
||||||
|
'application/x-java-application',
|
||||||
|
'application/x-jar',
|
||||||
|
'application/x-compressed',
|
||||||
|
],
|
||||||
|
'svg' => [
|
||||||
|
'image/svg+xml',
|
||||||
|
'image/svg',
|
||||||
|
'application/xml',
|
||||||
|
'text/xml',
|
||||||
|
],
|
||||||
|
'vcf' => 'text/x-vcard',
|
||||||
|
'srt' => [
|
||||||
|
'text/srt',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'vtt' => [
|
||||||
|
'text/vtt',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
'ico' => [
|
||||||
|
'image/x-icon',
|
||||||
|
'image/x-ico',
|
||||||
|
'image/vnd.microsoft.icon',
|
||||||
|
],
|
||||||
|
'stl' => [
|
||||||
|
'application/sla',
|
||||||
|
'application/vnd.ms-pki.stl',
|
||||||
|
'application/x-navistyle',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to determine the best mime type for the given file extension.
|
||||||
|
*
|
||||||
|
* @return string|null The mime type found, or none if unable to determine.
|
||||||
|
*/
|
||||||
|
public static function guessTypeFromExtension(string $extension)
|
||||||
|
{
|
||||||
|
$extension = trim(strtolower($extension), '. ');
|
||||||
|
|
||||||
|
if (! array_key_exists($extension, static::$mimes)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return is_array(static::$mimes[$extension]) ? static::$mimes[$extension][0] : static::$mimes[$extension];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to determine the best file extension for a given mime type.
|
||||||
|
*
|
||||||
|
* @param string|null $proposedExtension - default extension (in case there is more than one with the same mime type)
|
||||||
|
*
|
||||||
|
* @return string|null The extension determined, or null if unable to match.
|
||||||
|
*/
|
||||||
|
public static function guessExtensionFromType(string $type, ?string $proposedExtension = null)
|
||||||
|
{
|
||||||
|
$type = trim(strtolower($type), '. ');
|
||||||
|
|
||||||
|
$proposedExtension = trim(strtolower($proposedExtension ?? ''));
|
||||||
|
|
||||||
|
if ($proposedExtension !== '') {
|
||||||
|
if (array_key_exists($proposedExtension, static::$mimes) && in_array($type, is_string(static::$mimes[$proposedExtension]) ? [static::$mimes[$proposedExtension]] : static::$mimes[$proposedExtension], true)) {
|
||||||
|
// The detected mime type matches with the proposed extension.
|
||||||
|
return $proposedExtension;
|
||||||
|
}
|
||||||
|
|
||||||
|
// An extension was proposed, but the media type does not match the mime type list.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reverse check the mime type list if no extension was proposed.
|
||||||
|
// This search is order sensitive!
|
||||||
|
foreach (static::$mimes as $ext => $types) {
|
||||||
|
if ((is_string($types) && $types === $type) || (is_array($types) && in_array($type, $types, true))) {
|
||||||
|
return $ext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
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 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 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',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
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',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Items Per Page
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The default number of results shown in a single page.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $perPage = 20;
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paths
|
||||||
|
*
|
||||||
|
* Holds the paths that are used by the system to
|
||||||
|
* locate the main directories, app, system, etc.
|
||||||
|
*
|
||||||
|
* Modifying these allows you to restructure your application,
|
||||||
|
* share a system folder between multiple applications, and more.
|
||||||
|
*
|
||||||
|
* 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__ . '/../../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__ . '/..';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
* 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
* TESTS DIRECTORY NAME
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This variable must contain the name of your "tests" directory.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $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';
|
||||||
|
}
|
||||||
@@ -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 => '#\.(?css|js|map|htm?|xml|json|webmanifest|tff|eot|woff?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
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
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
$routes->setDefaultNamespace('App\Controllers');
|
||||||
|
$routes->setDefaultController('Home');
|
||||||
|
$routes->setDefaultMethod('index');
|
||||||
|
$routes->setTranslateURIDashes(false);
|
||||||
|
$routes->set404Override();
|
||||||
|
$routes->setAutoRoute(true);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* Route Definitions
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
// We get a performance increase by specifying the default
|
||||||
|
// route since we don't have to scan directories.
|
||||||
|
$routes->get('/', 'Home::index');
|
||||||
|
$routes->get('/wp/', 'Dengine::index');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* Additional Routing
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* There will often be times that you need additional routing and you
|
||||||
|
* need it to be able to override any defaults in this file. Environment
|
||||||
|
* based routes is one such time. require() additional route files here
|
||||||
|
* to make that happen.
|
||||||
|
*
|
||||||
|
* 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';
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class Security extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Protection Method
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Protection Method for Cross Site Request Forgery protection.
|
||||||
|
*
|
||||||
|
* @var string 'cookie' or 'session'
|
||||||
|
*/
|
||||||
|
public $csrfProtection = 'cookie';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Token Randomization
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Randomize the CSRF Token for added security.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $tokenRandomize = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Token Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Token name for Cross Site Request Forgery protection.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $tokenName = 'csrf_test_name';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Header Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Header name for Cross Site Request Forgery protection.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $headerName = 'X-CSRF-TOKEN';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Cookie Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Cookie name for Cross Site Request Forgery protection.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $cookieName = 'csrf_cookie_name';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Expires
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Expiration time for Cross Site Request Forgery protection cookie.
|
||||||
|
*
|
||||||
|
* Defaults to two hours (in seconds).
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $expires = 7200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Regenerate
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Regenerate CSRF Token on every submission.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $regenerate = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Redirect
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Redirect to previous page with error on failure.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $redirect = 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
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public $samesite = 'Lax';
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Services Configuration file.
|
||||||
|
*
|
||||||
|
* Services are simply other classes/libraries that the system uses
|
||||||
|
* to do its job. This is used by CodeIgniter to allow the core of the
|
||||||
|
* framework to be swapped out easily without affecting the usage within
|
||||||
|
* the rest of your application.
|
||||||
|
*
|
||||||
|
* This file holds any application-specific services, or service overrides
|
||||||
|
* that you might need. An example has been included with the general
|
||||||
|
* method format you should use for your service methods. For more examples,
|
||||||
|
* see the core Services file at system/Config/Services.php.
|
||||||
|
*/
|
||||||
|
class Services extends BaseService
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* public static function example($getShared = true)
|
||||||
|
* {
|
||||||
|
* if ($getShared) {
|
||||||
|
* return static::getSharedInstance('example');
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* return new \CodeIgniter\Example();
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use CodeIgniter\Debug\Toolbar\Collectors\Database;
|
||||||
|
use CodeIgniter\Debug\Toolbar\Collectors\Events;
|
||||||
|
use CodeIgniter\Debug\Toolbar\Collectors\Files;
|
||||||
|
use CodeIgniter\Debug\Toolbar\Collectors\Logs;
|
||||||
|
use CodeIgniter\Debug\Toolbar\Collectors\Routes;
|
||||||
|
use CodeIgniter\Debug\Toolbar\Collectors\Timers;
|
||||||
|
use CodeIgniter\Debug\Toolbar\Collectors\Views;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Debug Toolbar
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The Debug Toolbar provides a way to see information about the performance
|
||||||
|
* and state of your application during that page display. By default it will
|
||||||
|
* NOT be displayed under production environments, and will only display if
|
||||||
|
* `CI_DEBUG` is true, since if it's not, there's not much to display anyway.
|
||||||
|
*/
|
||||||
|
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,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Collect Var Data
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* If set to false var data from the views will not be colleted. Usefull to
|
||||||
|
* avoid high memory usage when there are lots of data passed to the view.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $collectVarData = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 int
|
||||||
|
*/
|
||||||
|
public $maxHistory = 20;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 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 int
|
||||||
|
*/
|
||||||
|
public $maxQueries = 100;
|
||||||
|
}
|
||||||
@@ -0,0 +1,252 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* User Agents
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This file contains four arrays of user agent data. It is used by the
|
||||||
|
* User Agent Class to help identify browser, platform, robot, and
|
||||||
|
* mobile device data. The array keys are used to identify the device
|
||||||
|
* and the array values are used to set the actual name of the item.
|
||||||
|
*/
|
||||||
|
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',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* 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',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* 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'
|
||||||
|
|
||||||
|
// 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',
|
||||||
|
|
||||||
|
// 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',
|
||||||
|
|
||||||
|
// 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',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Validation\CreditCardRules;
|
||||||
|
use CodeIgniter\Validation\FileRules;
|
||||||
|
use CodeIgniter\Validation\FormatRules;
|
||||||
|
use CodeIgniter\Validation\Rules;
|
||||||
|
|
||||||
|
class Validation
|
||||||
|
{
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Setup
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the classes that contain the
|
||||||
|
* rules that are available.
|
||||||
|
*
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
public $ruleSets = [
|
||||||
|
Rules::class,
|
||||||
|
FormatRules::class,
|
||||||
|
FileRules::class,
|
||||||
|
CreditCardRules::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the views that are used to display the
|
||||||
|
* errors.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public $templates = [
|
||||||
|
'list' => 'CodeIgniter\Validation\Views\list',
|
||||||
|
'single' => 'CodeIgniter\Validation\Views\single',
|
||||||
|
];
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Rules
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\View as BaseView;
|
||||||
|
|
||||||
|
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 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 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 = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
use CodeIgniter\HTTP\CLIRequest;
|
||||||
|
use CodeIgniter\HTTP\IncomingRequest;
|
||||||
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class BaseController
|
||||||
|
*
|
||||||
|
* BaseController provides a convenient place for loading components
|
||||||
|
* and performing functions that are needed by all your controllers.
|
||||||
|
* Extend this class in any new controllers:
|
||||||
|
* class Home extends BaseController
|
||||||
|
*
|
||||||
|
* For security be sure to declare any new methods as protected or private.
|
||||||
|
*/
|
||||||
|
class BaseController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 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 = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
use CodeIgniter\API\ResponseTrait;
|
||||||
|
|
||||||
|
class Dengine extends BaseController
|
||||||
|
{
|
||||||
|
use ResponseTrait;
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$res1 =[
|
||||||
|
[
|
||||||
|
"id" => 78,
|
||||||
|
"ID" => 78,
|
||||||
|
"post_author" => 1,
|
||||||
|
"post_date" => "2018-06-25T18:54:22.000Z",
|
||||||
|
"post_date_gmt" => "2018-06-25T18:54:22.000Z",
|
||||||
|
"post_content" => "Globalization spells danger for the type of jobs that will be available at graduation. The nature of jobs changes so often that it could frustrate for the students. The changes also present new opportunities. Globalization also ensures that job can come anonymously from any part of the world and transaction can be completed privately.\n\nThis is where <a href=\"https://www.wrenchboard.com\">WrenchBoard </a>comes in, rather than focus on your primary education as your source of income, the new economy will look at your skills as this guide. Your question is to self-examine and attributes values to what you have that others need to make their own or goal complete.\n\nUniversity students can earn extra income along with their regular educational and school work by taking part-time tasks online. To get a project up and running there are a lot of components of service that every business goes through and there are those tasks that students can attend to. Students are in best position to do an initial critique of sites, write articles that bear innocence or interest meddling or test an app for a company in beta phase.\n\nThe online nature of the jobs gives the student the necessary flexibility to operate and added the benefit of interacting with people that don’t think like them, it is an opportunity for the larger world. It is getting very hard to manufacture excuses for not to be involved with one online job or the other when the opportunities and the capabilities collide. A student should be made aware of the fact that life is going to get busier once the excuse of the school is removed.\n\nThere are many jobs students can easily do online\n<ul>\n \t<li>\tOnline marketing - most students have Facebooks and other social environments with tons of friends or connection. Somebody on this planet needs that profile or demography and will be will to pay for it if there is a way to do so</li>\n \t<li>\nTeaching - being a student also has the benefit of living in environment where you play with commercial tools, somebody have question about those tools you are playing with that they are willing to pay for - for example, student work with expensive robots in labs and an industrial hand may have questions that you can check out in your experiment environment</li>\n \t<li>\nWriting Articles/Blogging -</li>\n \t<li>\nSurveys/Research</li>\n \t<li>Campaigns</li>\n</ul>",
|
||||||
|
"post_title" => "Online Jobs for University Students",
|
||||||
|
"post_excerpt" => "",
|
||||||
|
"post_status" => "publish",
|
||||||
|
"comment_status" => "open",
|
||||||
|
"ping_status" => "open",
|
||||||
|
"post_password" => "",
|
||||||
|
"post_name" => "online-jobs-university-students",
|
||||||
|
"to_ping" => "",
|
||||||
|
"pinged" => "",
|
||||||
|
"post_modified" => "2022-01-22T03:39:48.000Z",
|
||||||
|
"post_modified_gmt" => "2022-01-22T03:39:48.000Z",
|
||||||
|
"post_content_filtered" => "",
|
||||||
|
"post_parent" => 0,
|
||||||
|
"guid" => "https://blog.wrenchboard.com/?p=78",
|
||||||
|
"menu_order" => 0,
|
||||||
|
"post_type" => "post",
|
||||||
|
"post_mime_type" => "",
|
||||||
|
"comment_count" => 0,
|
||||||
|
"meta_value" => "2022/01/universitty.jpg"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"id" => 41,
|
||||||
|
"ID" => 41,
|
||||||
|
"post_author" => 1,
|
||||||
|
"post_date" => "2017-11-23T14:05:51.000Z",
|
||||||
|
"post_date_gmt" => "2017-11-23T14:05:51.000Z",
|
||||||
|
"post_content" => "There are different types of online jobs and some pay more money than others do while some typing jobs may need special equipment, education, or training in order to do them. The advantage of an online job is that you can work at any time of the day around your personal schedule. You can even work in the evening or at night.\n\nYour income from an online job will also depend on the kind of job you do, your experience and your skills.\n\n<strong>Price management</strong>\n\nFirstly, you will need to establish the services you will offer your clients and a business essentially succeeds by filling a void or a niche in the market.\n\nEnsure you are familiar with the different online jobs out there as each job category pays differently. The categories of online jobs include Copywriting, SEO copywriting, Content writing, Proofreading, editing, freelance writing, social media marketing and professional blogging. You do not have to work in one field only; you can work in various fields. Research on how much each field pays; this is so you do not sell yourself short and earn less money than you should be earning.\n\nAlways do your best work for every project as the quality of your work will speak for you and you can gauge your prices better while establishing your reputation.\n\nNetworking is also essential both online and in person. You can use social media platforms like LinkedIn to network online. The more you work towards being noticed, the more clients and projects you will get.\n\n<strong>Time management </strong>\n\nWorking an online business means, you will be working from home in most cases and time management is an essential part of working online. Here are a few tips to help you manage your time better with an online job.\n<ul>\n \t<li>Remove all the extra tabs from your web browser, as they can be reminders of the fact that the internet is a vast wormhole of your attention. Open fewer tabs if you want to have a more productive workday.</li>\n \t<li>Remove papers from your desktop as a ton of paperwork on your desktop could discourage you from remaining focused. Ensure you clear your desktop after each workday.</li>\n \t<li>Avoid social media interruptions as social media can hinder your productivity if you do not practice mindfulness. You can set up a specific time to socialize before your workday begins or just before retiring after your workday.</li>\n \t<li>Block any needless distractions because at times pure silence might be all you need to do to enhance your production. Turn your radio, television, or telephone off. Avoid visiting any social media platforms, ignore email notifications, and even close your browser.</li>\n \t<li>Select the best time for you to work; you may find that you are more productive during certain hours of the day. Find out what your optimal time frame is and work during said hours so that you get more work done. Most importantly, ensure you follow your schedule strictly.</li>\n</ul>\n ",
|
||||||
|
"post_title" => "Time and price management when working an online job",
|
||||||
|
"post_excerpt" => "",
|
||||||
|
"post_status" => "publish",
|
||||||
|
"comment_status" => "open",
|
||||||
|
"ping_status" => "open",
|
||||||
|
"post_password" => "",
|
||||||
|
"post_name" => "time-price-management-working-online-job",
|
||||||
|
"to_ping" => "",
|
||||||
|
"pinged" => "",
|
||||||
|
"post_modified" => "2022-01-22T03:35:09.000Z",
|
||||||
|
"post_modified_gmt" => "2022-01-22T03:35:09.000Z",
|
||||||
|
"post_content_filtered" => "",
|
||||||
|
"post_parent" => 0,
|
||||||
|
"guid" => "https://blog.wrenchboard.com/?p=41",
|
||||||
|
"menu_order" => 0,
|
||||||
|
"post_type" => "post",
|
||||||
|
"post_mime_type" => "",
|
||||||
|
"comment_count" => 0,
|
||||||
|
"meta_value" => "2022/01/time_manageent.jpg"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"id" => 39,
|
||||||
|
"ID" => 39,
|
||||||
|
"post_author" => 1,
|
||||||
|
"post_date" => "2017-11-23T14:04:49.000Z",
|
||||||
|
"post_date_gmt" => "2017-11-23T14:04:49.000Z",
|
||||||
|
"post_content" => "Content syndication involves methods of content republication on other websites so you can reach a wider audience. Syndication of your content is a great way to enhance your brand awareness and your reach, direct traffic to your article, and build links. The internet is vast and it is not reasonable to assume that everyone you want to reach will read your content simply because you published it on your own site. Syndicating your content gets it to a different audience who might have never known it was there in the first place. Content syndication is a good and cheap way to further your content. It is a content marketing strategy. There are 4 kinds of content syndication you should know of:\n<ol>\n \t<li><strong>Syndicating content (3rd party) on your website </strong></li>\n</ol>\nPublishers can ask different websites for permission to display their content on your website or blog. Your site should have roughly 10% syndicated content ideally. Even though it might be unoriginal, it is always good to feature useful content that your readers will find beneficial and worth reading. It is difficult to find great authors committed to writing content for you when you run a website or blog with multiple authors. Ask an influencer on whether you can feature their existing content as a reasonable resolution. Syndicated content diversifies your site content instantly by highlighting something valuable and new to your target audience.\n<ol start=\"2\">\n \t<li><strong>Syndicating your content on other blogs or websites</strong></li>\n</ol>\nPublishers can syndicate their content to be displayed on another partner website or sites. You can either create content that is not original for your partner who will just be republishing your content. Alternatively, you can agree on a split which both sides find acceptable i.e. you can give them syndicated content for one month and produce original content the next month. If the agreement calls for 1-4 posts monthly, one of them must at least be original.\n<ol start=\"3\">\n \t<li><strong>Publish your content on websites syndicating their content</strong></li>\n</ol>\nAnother way to syndicate your content is by contributing regularly to websites already syndicating their content. Think of it this way, if you are publishing your content for a specific website on a regular basis and they are content syndicators, their content would also end up on other significant partner websites.\n<ol start=\"4\">\n \t<li><strong>Self-service syndication</strong></li>\n</ol>\nPublishers are also able to syndicate their own content with Medium as a great place to start with this endeavor. Medium allows you to import your already existing content from the internet edit, format, and publishing it. It allows you to run your own publications using minimal effort. LinkedIn is another platform you can use to republish your own website content so it reaches a bigger audience.\n\nYou have tools available at your disposal that can help you get your content to a wider target audience while enhancing traffic to your website, establishing a stronger following, and developing your reputation.",
|
||||||
|
"post_title" => "How to use syndication techniques to promote your articles online",
|
||||||
|
"post_excerpt" => "",
|
||||||
|
"post_status" => "publish",
|
||||||
|
"comment_status" => "open",
|
||||||
|
"ping_status" => "open",
|
||||||
|
"post_password" => "",
|
||||||
|
"post_name" => "use-syndication-techniques-promote-articles-online",
|
||||||
|
"to_ping" => "",
|
||||||
|
"pinged" => "",
|
||||||
|
"post_modified" => "2022-01-22T03:28:35.000Z",
|
||||||
|
"post_modified_gmt" => "2022-01-22T03:28:35.000Z",
|
||||||
|
"post_content_filtered" => "",
|
||||||
|
"post_parent" => 0,
|
||||||
|
"guid" => "https://blog.wrenchboard.com/?p=39",
|
||||||
|
"menu_order" => 0,
|
||||||
|
"post_type" => "post",
|
||||||
|
"post_mime_type" => "",
|
||||||
|
"comment_count" => 0,
|
||||||
|
"meta_value" => "2022/01/man_reading.jpg"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"id" => 37,
|
||||||
|
"ID" => 37,
|
||||||
|
"post_author" => 1,
|
||||||
|
"post_date" => "2017-11-23T14:03:39.000Z",
|
||||||
|
"post_date_gmt" => "2017-11-23T14:03:39.000Z",
|
||||||
|
"post_content" => "<strong>Paying mind to similarity index and why ignoring it could have serious repercussions </strong>\n\nThe similarity index is a term you should be familiar with as an online writer. It is defined as the composite number that is highlighted after matching two texts to determine how similar the content from both pieces is. It is typically displayed as a percentage and the displayed number measures the percentage of your article that the program found the matching text for. This is regardless of proper citation in your work or lack thereof.\n\nIf the similarity index is high this could mean the writer has quoted various other works to a large extent even if it is legitimate.\n\nIt is understandable that you will want to offer quality content for search engines in terms of consideration and indexation and this can lead you to weed your indexable content down. You may also be worried that search engines will not be able to comprehend your content due to existing similar pages because of things like product variations. It will be unwise for you to rush into a decision that could damage your SEO in the process of trying to make search engines happy while destroying your organic visibility in the process.\n\nYou can make use of canonical tags to instruct crawling search engines of the representative alternatives of similar or duplicate content. You just have to place these tags within your source code head section. Canonical tags are very effective in dealing with similar or duplicate content. The easiest way to determine whether you have similar content on your website is to review the site manually while addressing sections of the site appearing to have different URLs but similar content. Take some of the URLs and use tools such as Similar Page Checker or simply review the site for any similar content using Siteliner.\n\nYou may also want to consider consolidating multiple pages into one or expanding certain pages if you have multiple pages that appear to be similar. For example, if you have a site with two distinct pages for different but related topics but the information is the same on both these pages, you may either expand each page further to encompass original content about each topic or merge both pages into one about both topics.\n\nSimilar content can present an issue if not addressed:\n\nYour website will suffer in terms of ranking and you may end up losing traffic. Both losses typically originate from 2 main issues\n\n- Search engines rarely show multiple options of similar content in order to give users an optimum search experience. They will, therefore, be forced to select the best version which will be shown as the best result diluting visibility of websites with similar or duplicate content.\n\n- Equity of links will also be diluted further because other websites will have to choose the best option from the duplicates. As opposed to all the inbound links directing to one content piece, they will link to several pieces distributing the equity of the links among these duplicates. Inbound links are considered a ranking factor so they can affect the search visibility of certain pieces of content.\n\nThe overall result is that the piece of content will not get the search visibility it deserves.\n\n ",
|
||||||
|
"post_title" => "Paying mind to similarity index",
|
||||||
|
"post_excerpt" => "",
|
||||||
|
"post_status" => "publish",
|
||||||
|
"comment_status" => "open",
|
||||||
|
"ping_status" => "open",
|
||||||
|
"post_password" => "",
|
||||||
|
"post_name" => "paying-mind-similarity-index",
|
||||||
|
"to_ping" => "",
|
||||||
|
"pinged" => "",
|
||||||
|
"post_modified" => "2022-01-02T22:42:29.000Z",
|
||||||
|
"post_modified_gmt" => "2022-01-02T22:42:29.000Z",
|
||||||
|
"post_content_filtered" => "",
|
||||||
|
"post_parent" => 0,
|
||||||
|
"guid" => "https://blog.wrenchboard.com/?p=37",
|
||||||
|
"menu_order" => 0,
|
||||||
|
"post_type" => "post",
|
||||||
|
"post_mime_type" => "",
|
||||||
|
"comment_count" => 0,
|
||||||
|
"meta_value" => "2022/01/wrechboard-sample.jpg"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"id" => 35,
|
||||||
|
"ID" => 35,
|
||||||
|
"post_author" => 1,
|
||||||
|
"post_date" => "2017-11-23T14:02:54.000Z",
|
||||||
|
"post_date_gmt" => "2017-11-23T14:02:54.000Z",
|
||||||
|
"post_content" => "The internet is a vast source of information and you can use this information to improve and expand your skill set. You always stand to benefit by adding some extra skills to your CV. The internet is one of the best areas to look if you want to enhance your knowledge base and your skill set in an effort to impress your possible employers. There are so many ways to use the internet to gain extra technical skills\n\n<strong>Design</strong>\n\nThe internet is jam-packed with various online programs that people use for photo editing and graphic design for their websites and blogs. Such design skills must be stated in your CV if they will be relevant to the position you are applying for in any company. You can easily download the relevant design programs or apps from the internet and use your free time to sharpen your design skills while racking up your design portfolio. You may land a position in a good design agency if you have some good examples of your design work.\n\n<strong>Social media</strong>\n\nSocial media is another way that the internet has proven useful in that it can be used in more ways than one. Once you find a way to use social media to your advantage, this will be a valuable asset because lots of organizations are currently looking for social media skills when looking to hire new staff. Businesses have realized the benefit of using social media marketing in reaching out to a bigger audience. Think of ways to boost your follower base via your own social media pages like Instagram, Twitter, or Facebook. Such platforms and more like Snapchat or LinkedIn are free to download and easy to use plus there is a lot you can learn in terms of using your social media feed or platforms to attract followers which in itself is a form of marketing.\n\n<strong>IT skills</strong>\n\nThis is one of the obvious skills that one can polish online or on their computer. More businesses are being geared towards a digital direction and employers want to know they are hiring an applicant(s) with strong IT skills. This means you have to know how to use various programs and software to create different types of documents. Showing that you are highly proficient in computer applications and operation will do you justice when applying for different jobs or even starting your own business.\n\n<strong>Online Courses</strong>\n\nYou can now get plenty of qualifications from the comfort of your home as long as you have a computer and a strong internet connection. Find a free course that would be relevant or helpful to you, sign up, and you can begin studying as soon as immediately. There are many skills you can study online with these courses and you may add an impressive qualification to your resume. The advantage of online courses is that you can do them in coordination with your current schedule meaning you still get to earn while you study.\n\n<strong>Languages</strong>\n\nA second language also looks quite impressive on your CV as bilingual employees show to be quite useful if an employer’s business trades in an international market. You can use apps like Duolingo or sign up for an online course to learn a new language. A second language might really help you get work experience in foreign countries.",
|
||||||
|
"post_title" => "Using the internet to expand your technological skill set",
|
||||||
|
"post_excerpt" => "",
|
||||||
|
"post_status" => "publish",
|
||||||
|
"comment_status" => "open",
|
||||||
|
"ping_status" => "open",
|
||||||
|
"post_password" => "",
|
||||||
|
"post_name" => "using-internet-expand-technological-skill-set",
|
||||||
|
"to_ping" => "",
|
||||||
|
"pinged" => "",
|
||||||
|
"post_modified" => "2022-01-22T03:44:14.000Z",
|
||||||
|
"post_modified_gmt" => "2022-01-22T03:44:14.000Z",
|
||||||
|
"post_content_filtered" => "",
|
||||||
|
"post_parent" => 0,
|
||||||
|
"guid" => "https://blog.wrenchboard.com/?p=35",
|
||||||
|
"menu_order" => 0,
|
||||||
|
"post_type" => "post",
|
||||||
|
"post_mime_type" => "",
|
||||||
|
"comment_count" => 0,
|
||||||
|
"meta_value" => "2022/01/technology_skill.jpg"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"id" => 33,
|
||||||
|
"ID" => 33,
|
||||||
|
"post_author" => 1,
|
||||||
|
"post_date" => "2017-11-23T14:01:30.000Z",
|
||||||
|
"post_date_gmt" => "2017-11-23T14:01:30.000Z",
|
||||||
|
"post_content" => "Anyone can do an online job as long as you have the right set of skills. As your own boss, you will have to do plenty of day-to-day tasks yourself and you will need to practice good judgment on how you do things. This is why you need an effective strategy to help you progress your online career.\n\n<strong>You need the right skills</strong>\n\nAs does any job, you need to have the proper equipment and tools to accomplish things accordingly. This means you will have to invest in a good-quality PC or laptop, subscribe to a dependable ISP, and ensure you have a backup ISP in the event of an emergency. You could even get your own office with a backup computer, a cloud account, or a spare hard drive.\n\n<strong>You need to be dedicated to your career</strong>\n\nThe misconception that you need to go to college to learn all the skills you need to get a job in the outside world is not the case. Of course, you need to update your skills and knowledge to gain a competitive edge over your peers and colleagues. This means that you should always keep learning in order to have an effective online career or job. Read on industry news daily, take some courses to spruce up your skills; you can even go back to school.\n\n<strong>Technical proficiency</strong>\n\nComputer literacy is something you obviously must have when working on an online career. However, in order to progress with your career, you have to be up to date with current software and online tools available to help you be more efficient in your strategy.\n\n<strong>Ensure every project has a contract</strong>\n\nYou do not need something complex that will take you more time to look over when you should be using this time to make money. To start with, you should have a general agreement covering important but basic terms you and your client must agree on. Setting basic terms for each project helps to protect you and inform your clients of how you work. Some of the terms your contract must cover include payment terms and the client’s proprietary details etc. If things work in your favor and you show significant growth in your career, you will need a specially crafted contract courtesy of a legal professional.\n\n<strong>Focusing your business</strong>\n\nFocusing the identity of your brand and the caliber of projects you undertake will make things much easier on your part from the marketing process to the design work. Pick one service or even two and take on work falling along those lines then decline the rest. Deciding on the services you intend to specialize in will help you translate this in your brand. Everything on your website should be reworded to suit those specific phrases and keywords and only exhibit this kind of work in your portfolio. Begin producing content centered on these services to display your expertise. This is all a result of marketing and it will direct traffic and new projects in your direction.\n\n ",
|
||||||
|
"post_title" => "How to implement an effective online career strategy",
|
||||||
|
"post_excerpt" => "",
|
||||||
|
"post_status" => "publish",
|
||||||
|
"comment_status" => "open",
|
||||||
|
"ping_status" => "open",
|
||||||
|
"post_password" => "",
|
||||||
|
"post_name" => "implement-effective-online-career-strategy",
|
||||||
|
"to_ping" => "",
|
||||||
|
"pinged" => "",
|
||||||
|
"post_modified" => "2022-01-22T03:48:59.000Z",
|
||||||
|
"post_modified_gmt" => "2022-01-22T03:48:59.000Z",
|
||||||
|
"post_content_filtered" => "",
|
||||||
|
"post_parent" => 0,
|
||||||
|
"guid" => "https://blog.wrenchboard.com/?p=33",
|
||||||
|
"menu_order" => 0,
|
||||||
|
"post_type" => "post",
|
||||||
|
"post_mime_type" => "",
|
||||||
|
"comment_count" => 0,
|
||||||
|
"meta_value" => "2022/01/online_job.jpg"
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return $this->response->setJson($res1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
class Home extends BaseController
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('welcome_message');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// override core en language system validation or define your own en language validation message
|
||||||
|
return [];
|
||||||
Vendored
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use CodeIgniter\CLI\CLI;
|
||||||
|
|
||||||
|
CLI::error('ERROR: ' . $code);
|
||||||
|
CLI::write($message);
|
||||||
|
CLI::newLine();
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use CodeIgniter\CLI\CLI;
|
||||||
|
|
||||||
|
// The main Exception
|
||||||
|
CLI::newLine();
|
||||||
|
CLI::write('[' . get_class($exception) . ']', 'light_gray', 'red');
|
||||||
|
CLI::newLine();
|
||||||
|
CLI::write($message);
|
||||||
|
CLI::newLine();
|
||||||
|
CLI::write('at ' . CLI::color(clean_path($exception->getFile()) . ':' . $exception->getLine(), 'green'));
|
||||||
|
CLI::newLine();
|
||||||
|
|
||||||
|
// The backtrace
|
||||||
|
if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) {
|
||||||
|
$backtraces = $exception->getTrace();
|
||||||
|
|
||||||
|
if ($backtraces) {
|
||||||
|
CLI::write('Backtrace:', 'green');
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($backtraces as $i => $error) {
|
||||||
|
$padFile = ' '; // 4 spaces
|
||||||
|
$padClass = ' '; // 7 spaces
|
||||||
|
$c = str_pad($i + 1, 3, ' ', STR_PAD_LEFT);
|
||||||
|
|
||||||
|
if (isset($error['file'])) {
|
||||||
|
$filepath = clean_path($error['file']) . ':' . $error['line'];
|
||||||
|
|
||||||
|
CLI::write($c . $padFile . CLI::color($filepath, 'yellow'));
|
||||||
|
} else {
|
||||||
|
CLI::write($c . $padFile . CLI::color('[internal function]', 'yellow'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$function = '';
|
||||||
|
|
||||||
|
if (isset($error['class'])) {
|
||||||
|
$type = ($error['type'] === '->') ? '()' . $error['type'] : $error['type'];
|
||||||
|
$function .= $padClass . $error['class'] . $type . $error['function'];
|
||||||
|
} elseif (! isset($error['class']) && isset($error['function'])) {
|
||||||
|
$function .= $padClass . $error['function'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$args = implode(', ', array_map(static function ($value) {
|
||||||
|
switch (true) {
|
||||||
|
case is_object($value):
|
||||||
|
return 'Object(' . get_class($value) . ')';
|
||||||
|
|
||||||
|
case is_array($value):
|
||||||
|
return count($value) ? '[...]' : '[]';
|
||||||
|
|
||||||
|
case $value === null:
|
||||||
|
return 'null'; // return the lowercased version
|
||||||
|
|
||||||
|
default:
|
||||||
|
return var_export($value, true);
|
||||||
|
}
|
||||||
|
}, array_values($error['args'] ?? [])));
|
||||||
|
|
||||||
|
$function .= '(' . $args . ')';
|
||||||
|
|
||||||
|
CLI::write($function);
|
||||||
|
CLI::newLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// On the CLI, we still want errors in productions
|
||||||
|
// so just use the exception template.
|
||||||
|
include __DIR__ . '/error_exception.php';
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
:root {
|
||||||
|
--main-bg-color: #fff;
|
||||||
|
--main-text-color: #555;
|
||||||
|
--dark-text-color: #222;
|
||||||
|
--light-text-color: #c7c7c7;
|
||||||
|
--brand-primary-color: #E06E3F;
|
||||||
|
--light-bg-color: #ededee;
|
||||||
|
--dark-bg-color: #404040;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
height: 100%;
|
||||||
|
background: var(--main-bg-color);
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
|
||||||
|
color: var(--main-text-color);
|
||||||
|
font-weight: 300;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-weight: lighter;
|
||||||
|
letter-spacing: 0.8;
|
||||||
|
font-size: 3rem;
|
||||||
|
color: var(--dark-text-color);
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
h1.headline {
|
||||||
|
margin-top: 20%;
|
||||||
|
font-size: 5rem;
|
||||||
|
}
|
||||||
|
.text-center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
p.lead {
|
||||||
|
font-size: 1.6rem;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
max-width: 75rem;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
background: var(--light-bg-color);
|
||||||
|
color: var(--dark-text-color);
|
||||||
|
}
|
||||||
|
.header .container {
|
||||||
|
padding: 1rem 1.75rem 1.75rem 1.75rem;
|
||||||
|
}
|
||||||
|
.header h1 {
|
||||||
|
font-size: 2.5rem;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.header p {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
margin: 0;
|
||||||
|
line-height: 2.5;
|
||||||
|
}
|
||||||
|
.header a {
|
||||||
|
color: var(--brand-primary-color);
|
||||||
|
margin-left: 2rem;
|
||||||
|
display: none;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.header:hover a {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
background: var(--dark-bg-color);
|
||||||
|
color: var(--light-text-color);
|
||||||
|
}
|
||||||
|
.footer .container {
|
||||||
|
border-top: 1px solid #e7e7e7;
|
||||||
|
margin-top: 1rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.source {
|
||||||
|
background: #343434;
|
||||||
|
color: var(--light-text-color);
|
||||||
|
padding: 0.5em 1em;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
margin: 0;
|
||||||
|
overflow-x: scroll;
|
||||||
|
}
|
||||||
|
.source span.line {
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
.source span.line .number {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.source .line .highlight {
|
||||||
|
display: block;
|
||||||
|
background: var(--dark-text-color);
|
||||||
|
color: var(--light-text-color);
|
||||||
|
}
|
||||||
|
.source span.highlight .number {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabs {
|
||||||
|
list-style: none;
|
||||||
|
list-style-position: inside;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
margin-bottom: -1px;
|
||||||
|
}
|
||||||
|
.tabs li {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
.tabs a:link,
|
||||||
|
.tabs a:visited {
|
||||||
|
padding: 0rem 1rem;
|
||||||
|
line-height: 2.7;
|
||||||
|
text-decoration: none;
|
||||||
|
color: var(--dark-text-color);
|
||||||
|
background: var(--light-bg-color);
|
||||||
|
border: 1px solid rgba(0,0,0,0.15);
|
||||||
|
border-bottom: 0;
|
||||||
|
border-top-left-radius: 5px;
|
||||||
|
border-top-right-radius: 5px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.tabs a:hover {
|
||||||
|
background: var(--light-bg-color);
|
||||||
|
border-color: rgba(0,0,0,0.15);
|
||||||
|
}
|
||||||
|
.tabs a.active {
|
||||||
|
background: var(--main-bg-color);
|
||||||
|
color: var(--main-text-color);
|
||||||
|
}
|
||||||
|
.tab-content {
|
||||||
|
background: var(--main-bg-color);
|
||||||
|
border: 1px solid rgba(0,0,0,0.15);
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
.hide {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert {
|
||||||
|
margin-top: 2rem;
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 3.0;
|
||||||
|
background: #d9edf7;
|
||||||
|
border: 1px solid #bcdff1;
|
||||||
|
border-radius: 5px;
|
||||||
|
color: #31708f;
|
||||||
|
}
|
||||||
|
ul, ol {
|
||||||
|
line-height: 1.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
text-align: left;
|
||||||
|
border-bottom: 1px solid #e7e7e7;
|
||||||
|
padding-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
td {
|
||||||
|
padding: 0.2rem 0.5rem 0.2rem 0;
|
||||||
|
}
|
||||||
|
tr:hover td {
|
||||||
|
background: #f1f1f1;
|
||||||
|
}
|
||||||
|
td pre {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trace a {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
.trace table {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
.trace tr td:first-child {
|
||||||
|
min-width: 5em;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.trace td {
|
||||||
|
background: var(--light-bg-color);
|
||||||
|
padding: 0 1rem;
|
||||||
|
}
|
||||||
|
.trace td pre {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.args {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
// Tabs
|
||||||
|
|
||||||
|
var tabLinks = new Array();
|
||||||
|
var contentDivs = new Array();
|
||||||
|
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
// Grab the tab links and content divs from the page
|
||||||
|
var tabListItems = document.getElementById('tabs').childNodes;
|
||||||
|
console.log(tabListItems);
|
||||||
|
for (var i = 0; i < tabListItems.length; i ++)
|
||||||
|
{
|
||||||
|
if (tabListItems[i].nodeName == "LI")
|
||||||
|
{
|
||||||
|
var tabLink = getFirstChildWithTagName(tabListItems[i], 'A');
|
||||||
|
var id = getHash(tabLink.getAttribute('href'));
|
||||||
|
tabLinks[id] = tabLink;
|
||||||
|
contentDivs[id] = document.getElementById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assign onclick events to the tab links, and
|
||||||
|
// highlight the first tab
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
for (var id in tabLinks)
|
||||||
|
{
|
||||||
|
tabLinks[id].onclick = showTab;
|
||||||
|
tabLinks[id].onfocus = function () {
|
||||||
|
this.blur()
|
||||||
|
};
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
tabLinks[id].className = 'active';
|
||||||
|
}
|
||||||
|
i ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide all content divs except the first
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
for (var id in contentDivs)
|
||||||
|
{
|
||||||
|
if (i != 0)
|
||||||
|
{
|
||||||
|
console.log(contentDivs[id]);
|
||||||
|
contentDivs[id].className = 'content hide';
|
||||||
|
}
|
||||||
|
i ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showTab()
|
||||||
|
{
|
||||||
|
var selectedId = getHash(this.getAttribute('href'));
|
||||||
|
|
||||||
|
// Highlight the selected tab, and dim all others.
|
||||||
|
// Also show the selected content div, and hide all others.
|
||||||
|
for (var id in contentDivs)
|
||||||
|
{
|
||||||
|
if (id == selectedId)
|
||||||
|
{
|
||||||
|
tabLinks[id].className = 'active';
|
||||||
|
contentDivs[id].className = 'content';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tabLinks[id].className = '';
|
||||||
|
contentDivs[id].className = 'content hide';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop the browser following the link
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFirstChildWithTagName(element, tagName)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < element.childNodes.length; i ++)
|
||||||
|
{
|
||||||
|
if (element.childNodes[i].nodeName == tagName)
|
||||||
|
{
|
||||||
|
return element.childNodes[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getHash(url)
|
||||||
|
{
|
||||||
|
var hashPos = url.lastIndexOf('#');
|
||||||
|
return url.substring(hashPos + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggle(elem)
|
||||||
|
{
|
||||||
|
elem = document.getElementById(elem);
|
||||||
|
|
||||||
|
if (elem.style && elem.style['display'])
|
||||||
|
{
|
||||||
|
// Only works with the "style" attr
|
||||||
|
var disp = elem.style['display'];
|
||||||
|
}
|
||||||
|
else if (elem.currentStyle)
|
||||||
|
{
|
||||||
|
// For MSIE, naturally
|
||||||
|
var disp = elem.currentStyle['display'];
|
||||||
|
}
|
||||||
|
else if (window.getComputedStyle)
|
||||||
|
{
|
||||||
|
// For most other browsers
|
||||||
|
var disp = document.defaultView.getComputedStyle(elem, null).getPropertyValue('display');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Toggle the state of the "display" style
|
||||||
|
elem.style.display = disp == 'block' ? 'none' : 'block';
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>404 Page Not Found</title>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
div.logo {
|
||||||
|
height: 200px;
|
||||||
|
width: 155px;
|
||||||
|
display: inline-block;
|
||||||
|
opacity: 0.08;
|
||||||
|
position: absolute;
|
||||||
|
top: 2rem;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -73px;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
height: 100%;
|
||||||
|
background: #fafafa;
|
||||||
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
|
color: #777;
|
||||||
|
font-weight: 300;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-weight: lighter;
|
||||||
|
letter-spacing: 0.8;
|
||||||
|
font-size: 3rem;
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
color: #222;
|
||||||
|
}
|
||||||
|
.wrap {
|
||||||
|
max-width: 1024px;
|
||||||
|
margin: 5rem auto;
|
||||||
|
padding: 2rem;
|
||||||
|
background: #fff;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #efefef;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
white-space: normal;
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
}
|
||||||
|
code {
|
||||||
|
background: #fafafa;
|
||||||
|
border: 1px solid #efefef;
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
border-radius: 5px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
}
|
||||||
|
.footer {
|
||||||
|
margin-top: 2rem;
|
||||||
|
border-top: 1px solid #efefef;
|
||||||
|
padding: 1em 2em 0 2em;
|
||||||
|
font-size: 85%;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
a:active,
|
||||||
|
a:link,
|
||||||
|
a:visited {
|
||||||
|
color: #dd4814;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="wrap">
|
||||||
|
<h1>404 - File Not Found</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?php if (! empty($message) && $message !== '(null)') : ?>
|
||||||
|
<?= nl2br(esc($message)) ?>
|
||||||
|
<?php else : ?>
|
||||||
|
Sorry! Cannot seem to find the page you were looking for.
|
||||||
|
<?php endif ?>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,397 @@
|
|||||||
|
<?php $error_id = uniqid('error', true); ?>
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="robots" content="noindex">
|
||||||
|
|
||||||
|
<title><?= esc($title) ?></title>
|
||||||
|
<style type="text/css">
|
||||||
|
<?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.css')) ?>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
<?= file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.js') ?>
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="init()">
|
||||||
|
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="header">
|
||||||
|
<div class="container">
|
||||||
|
<h1><?= esc($title), esc($exception->getCode() ? ' #' . $exception->getCode() : '') ?></h1>
|
||||||
|
<p>
|
||||||
|
<?= nl2br(esc($exception->getMessage())) ?>
|
||||||
|
<a href="https://www.duckduckgo.com/?q=<?= urlencode($title . ' ' . preg_replace('#\'.*\'|".*"#Us', '', $exception->getMessage())) ?>"
|
||||||
|
rel="noreferrer" target="_blank">search →</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Source -->
|
||||||
|
<div class="container">
|
||||||
|
<p><b><?= esc(static::cleanPath($file, $line)) ?></b> at line <b><?= esc($line) ?></b></p>
|
||||||
|
|
||||||
|
<?php if (is_file($file)) : ?>
|
||||||
|
<div class="source">
|
||||||
|
<?= static::highlightFile($file, $line, 15); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<ul class="tabs" id="tabs">
|
||||||
|
<li><a href="#backtrace">Backtrace</a></li>
|
||||||
|
<li><a href="#server">Server</a></li>
|
||||||
|
<li><a href="#request">Request</a></li>
|
||||||
|
<li><a href="#response">Response</a></li>
|
||||||
|
<li><a href="#files">Files</a></li>
|
||||||
|
<li><a href="#memory">Memory</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<!-- Backtrace -->
|
||||||
|
<div class="content" id="backtrace">
|
||||||
|
|
||||||
|
<ol class="trace">
|
||||||
|
<?php foreach ($trace as $index => $row) : ?>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<p>
|
||||||
|
<!-- Trace info -->
|
||||||
|
<?php if (isset($row['file']) && is_file($row['file'])) :?>
|
||||||
|
<?php
|
||||||
|
if (isset($row['function']) && in_array($row['function'], ['include', 'include_once', 'require', 'require_once'], true)) {
|
||||||
|
echo esc($row['function'] . ' ' . static::cleanPath($row['file']));
|
||||||
|
} else {
|
||||||
|
echo esc(static::cleanPath($row['file']) . ' : ' . $row['line']);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php else : ?>
|
||||||
|
{PHP internal code}
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<!-- Class/Method -->
|
||||||
|
<?php if (isset($row['class'])) : ?>
|
||||||
|
— <?= esc($row['class'] . $row['type'] . $row['function']) ?>
|
||||||
|
<?php if (! empty($row['args'])) : ?>
|
||||||
|
<?php $args_id = $error_id . 'args' . $index ?>
|
||||||
|
( <a href="#" onclick="return toggle('<?= esc($args_id, 'attr') ?>');">arguments</a> )
|
||||||
|
<div class="args" id="<?= esc($args_id, 'attr') ?>">
|
||||||
|
<table cellspacing="0">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$params = null;
|
||||||
|
// Reflection by name is not available for closure function
|
||||||
|
if (substr($row['function'], -1) !== '}') {
|
||||||
|
$mirror = isset($row['class']) ? new \ReflectionMethod($row['class'], $row['function']) : new \ReflectionFunction($row['function']);
|
||||||
|
$params = $mirror->getParameters();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($row['args'] as $key => $value) : ?>
|
||||||
|
<tr>
|
||||||
|
<td><code><?= esc(isset($params[$key]) ? '$' . $params[$key]->name : "#{$key}") ?></code></td>
|
||||||
|
<td><pre><?= esc(print_r($value, true)) ?></pre></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach ?>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php else : ?>
|
||||||
|
()
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (! isset($row['class']) && isset($row['function'])) : ?>
|
||||||
|
— <?= esc($row['function']) ?>()
|
||||||
|
<?php endif; ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- Source? -->
|
||||||
|
<?php if (isset($row['file']) && is_file($row['file']) && isset($row['class'])) : ?>
|
||||||
|
<div class="source">
|
||||||
|
<?= static::highlightFile($row['file'], $row['line']) ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Server -->
|
||||||
|
<div class="content" id="server">
|
||||||
|
<?php foreach (['_SERVER', '_SESSION'] as $var) : ?>
|
||||||
|
<?php
|
||||||
|
if (empty($GLOBALS[$var]) || ! is_array($GLOBALS[$var])) {
|
||||||
|
continue;
|
||||||
|
} ?>
|
||||||
|
|
||||||
|
<h3>$<?= esc($var) ?></h3>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Key</th>
|
||||||
|
<th>Value</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($GLOBALS[$var] as $key => $value) : ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= esc($key) ?></td>
|
||||||
|
<td>
|
||||||
|
<?php if (is_string($value)) : ?>
|
||||||
|
<?= esc($value) ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<pre><?= esc(print_r($value, true)) ?></pre>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php endforeach ?>
|
||||||
|
|
||||||
|
<!-- Constants -->
|
||||||
|
<?php $constants = get_defined_constants(true); ?>
|
||||||
|
<?php if (! empty($constants['user'])) : ?>
|
||||||
|
<h3>Constants</h3>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Key</th>
|
||||||
|
<th>Value</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($constants['user'] as $key => $value) : ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= esc($key) ?></td>
|
||||||
|
<td>
|
||||||
|
<?php if (is_string($value)) : ?>
|
||||||
|
<?= esc($value) ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<pre><?= esc(print_r($value, true)) ?></pre>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Request -->
|
||||||
|
<div class="content" id="request">
|
||||||
|
<?php $request = \Config\Services::request(); ?>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 10em">Path</td>
|
||||||
|
<td><?= esc($request->getUri()) ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>HTTP Method</td>
|
||||||
|
<td><?= esc($request->getMethod(true)) ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>IP Address</td>
|
||||||
|
<td><?= esc($request->getIPAddress()) ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 10em">Is AJAX Request?</td>
|
||||||
|
<td><?= $request->isAJAX() ? 'yes' : 'no' ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Is CLI Request?</td>
|
||||||
|
<td><?= $request->isCLI() ? 'yes' : 'no' ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Is Secure Request?</td>
|
||||||
|
<td><?= $request->isSecure() ? 'yes' : 'no' ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>User Agent</td>
|
||||||
|
<td><?= esc($request->getUserAgent()->getAgentString()) ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<?php $empty = true; ?>
|
||||||
|
<?php foreach (['_GET', '_POST', '_COOKIE'] as $var) : ?>
|
||||||
|
<?php
|
||||||
|
if (empty($GLOBALS[$var]) || ! is_array($GLOBALS[$var])) {
|
||||||
|
continue;
|
||||||
|
} ?>
|
||||||
|
|
||||||
|
<?php $empty = false; ?>
|
||||||
|
|
||||||
|
<h3>$<?= esc($var) ?></h3>
|
||||||
|
|
||||||
|
<table style="width: 100%">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Key</th>
|
||||||
|
<th>Value</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($GLOBALS[$var] as $key => $value) : ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= esc($key) ?></td>
|
||||||
|
<td>
|
||||||
|
<?php if (is_string($value)) : ?>
|
||||||
|
<?= esc($value) ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<pre><?= esc(print_r($value, true)) ?></pre>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php endforeach ?>
|
||||||
|
|
||||||
|
<?php if ($empty) : ?>
|
||||||
|
|
||||||
|
<div class="alert">
|
||||||
|
No $_GET, $_POST, or $_COOKIE Information to show.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php $headers = $request->getHeaders(); ?>
|
||||||
|
<?php if (! empty($headers)) : ?>
|
||||||
|
|
||||||
|
<h3>Headers</h3>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Header</th>
|
||||||
|
<th>Value</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($headers as $value) : ?>
|
||||||
|
<?php
|
||||||
|
if (empty($value)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! is_array($value)) {
|
||||||
|
$value = [$value];
|
||||||
|
} ?>
|
||||||
|
<?php foreach ($value as $h) : ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= esc($h->getName(), 'html') ?></td>
|
||||||
|
<td><?= esc($h->getValueLine(), 'html') ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Response -->
|
||||||
|
<?php
|
||||||
|
$response = \Config\Services::response();
|
||||||
|
$response->setStatusCode(http_response_code());
|
||||||
|
?>
|
||||||
|
<div class="content" id="response">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 15em">Response Status</td>
|
||||||
|
<td><?= esc($response->getStatusCode() . ' - ' . $response->getReason()) ?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php $headers = $response->getHeaders(); ?>
|
||||||
|
<?php if (! empty($headers)) : ?>
|
||||||
|
<?php natsort($headers) ?>
|
||||||
|
|
||||||
|
<h3>Headers</h3>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Header</th>
|
||||||
|
<th>Value</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($headers as $name => $value) : ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= esc($name, 'html') ?></td>
|
||||||
|
<td><?= esc($response->getHeaderLine($name), 'html') ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Files -->
|
||||||
|
<div class="content" id="files">
|
||||||
|
<?php $files = get_included_files(); ?>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<?php foreach ($files as $file) :?>
|
||||||
|
<li><?= esc(static::cleanPath($file)) ?></li>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Memory -->
|
||||||
|
<div class="content" id="memory">
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Memory Usage</td>
|
||||||
|
<td><?= esc(static::describeMemory(memory_get_usage(true))) ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 12em">Peak Memory Usage:</td>
|
||||||
|
<td><?= esc(static::describeMemory(memory_get_peak_usage(true))) ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Memory Limit:</td>
|
||||||
|
<td><?= esc(ini_get('memory_limit')) ?></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div> <!-- /tab-content -->
|
||||||
|
|
||||||
|
</div> <!-- /container -->
|
||||||
|
|
||||||
|
<div class="footer">
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Displayed at <?= esc(date('H:i:sa')) ?> —
|
||||||
|
PHP: <?= esc(PHP_VERSION) ?> —
|
||||||
|
CodeIgniter: <?= esc(\CodeIgniter\CodeIgniter::CI_VERSION) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="robots" content="noindex">
|
||||||
|
|
||||||
|
<title>Whoops!</title>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
<?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.css')) ?>
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="container text-center">
|
||||||
|
|
||||||
|
<h1 class="headline">Whoops!</h1>
|
||||||
|
|
||||||
|
<p class="lead">We seem to have hit a snag. Please try again later...</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>403 Forbidden</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
{
|
||||||
|
"name": "codeigniter4/codeigniter4",
|
||||||
|
"type": "project",
|
||||||
|
"description": "The CodeIgniter framework v4",
|
||||||
|
"homepage": "https://codeigniter.com",
|
||||||
|
"license": "MIT",
|
||||||
|
"require": {
|
||||||
|
"php": "^7.3 || ^8.0",
|
||||||
|
"ext-curl": "*",
|
||||||
|
"ext-intl": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"kint-php/kint": "^4.0",
|
||||||
|
"laminas/laminas-escaper": "^2.9",
|
||||||
|
"psr/log": "^1.1"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"codeigniter/coding-standard": "^1.1",
|
||||||
|
"fakerphp/faker": "^1.9",
|
||||||
|
"friendsofphp/php-cs-fixer": "^3.1",
|
||||||
|
"mikey179/vfsstream": "^1.6",
|
||||||
|
"nexusphp/cs-config": "^3.3",
|
||||||
|
"nexusphp/tachycardia": "^1.0",
|
||||||
|
"phpstan/phpstan": "^1.0",
|
||||||
|
"phpunit/phpunit": "^9.1",
|
||||||
|
"predis/predis": "^1.1",
|
||||||
|
"rector/rector": "0.12.10"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-fileinfo": "Improves mime type detection for files"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"optimize-autoloader": true,
|
||||||
|
"preferred-install": "dist",
|
||||||
|
"sort-packages": true
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-develop": "4.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"CodeIgniter\\": "system/"
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"**/Database/Migrations/**"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"CodeIgniter\\": "tests/system/",
|
||||||
|
"Utils\\": "utils/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"post-update-cmd": [
|
||||||
|
"CodeIgniter\\ComposerScripts::postUpdate",
|
||||||
|
"bash -c \"if [ -f admin/setup.sh ]; then bash admin/setup.sh; fi\""
|
||||||
|
],
|
||||||
|
"analyze": "phpstan analyse",
|
||||||
|
"test": "phpunit",
|
||||||
|
"cs": [
|
||||||
|
"php-cs-fixer fix --verbose --dry-run --diff --config=.no-header.php-cs-fixer.dist.php",
|
||||||
|
"php-cs-fixer fix --verbose --dry-run --diff"
|
||||||
|
],
|
||||||
|
"cs-fix": [
|
||||||
|
"php-cs-fixer fix --verbose --diff --config=.no-header.php-cs-fixer.dist.php",
|
||||||
|
"php-cs-fixer fix --verbose --diff"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"scripts-descriptions": {
|
||||||
|
"analyze": "Run static analysis",
|
||||||
|
"test": "Run unit tests",
|
||||||
|
"cs": "Check the coding style",
|
||||||
|
"cs-fix": "Fix the coding style"
|
||||||
|
},
|
||||||
|
"support": {
|
||||||
|
"forum": "http://forum.codeigniter.com/",
|
||||||
|
"source": "https://github.com/codeigniter4/CodeIgniter4",
|
||||||
|
"slack": "https://codeigniterchat.slack.com"
|
||||||
|
}
|
||||||
|
}
|
||||||
+231
@@ -0,0 +1,231 @@
|
|||||||
|
# Defines the layers for each framework
|
||||||
|
# component and their allowed interactions.
|
||||||
|
# The following components are exempt
|
||||||
|
# due to their global nature:
|
||||||
|
# - CLI & Commands
|
||||||
|
# - Config
|
||||||
|
# - Debug
|
||||||
|
# - Exception
|
||||||
|
# - Service
|
||||||
|
# - Validation\FormatRules
|
||||||
|
paths:
|
||||||
|
- ./app
|
||||||
|
- ./system
|
||||||
|
exclude_files:
|
||||||
|
- '#.*test.*#i'
|
||||||
|
layers:
|
||||||
|
- name: API
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\API\\.*
|
||||||
|
- name: Cache
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Cache\\.*
|
||||||
|
- name: Controller
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^CodeIgniter\\Controller$
|
||||||
|
- name: Cookie
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Cookie\\.*
|
||||||
|
- name: Database
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Database\\.*
|
||||||
|
- name: Email
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Email\\.*
|
||||||
|
- name: Encryption
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Encryption\\.*
|
||||||
|
- name: Entity
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Entity\\.*
|
||||||
|
- name: Events
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Events\\.*
|
||||||
|
- name: Files
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Files\\.*
|
||||||
|
- name: Filters
|
||||||
|
collectors:
|
||||||
|
- type: bool
|
||||||
|
must:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Filters\\Filter.*
|
||||||
|
- name: Format
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Format\\.*
|
||||||
|
- name: Honeypot
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\.*Honeypot.* # includes the Filter
|
||||||
|
- name: HTTP
|
||||||
|
collectors:
|
||||||
|
- type: bool
|
||||||
|
must:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\HTTP\\.*
|
||||||
|
must_not:
|
||||||
|
- type: className
|
||||||
|
regex: (Exception|URI)
|
||||||
|
- name: I18n
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\I18n\\.*
|
||||||
|
- name: Images
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Images\\.*
|
||||||
|
- name: Language
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Language\\.*
|
||||||
|
- name: Log
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Log\\.*
|
||||||
|
- name: Model
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\.*Model$
|
||||||
|
- name: Modules
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Modules\\.*
|
||||||
|
- name: Pager
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Pager\\.*
|
||||||
|
- name: Publisher
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Publisher\\.*
|
||||||
|
- name: RESTful
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\RESTful\\.*
|
||||||
|
- name: Router
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Router\\.*
|
||||||
|
- name: Security
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Security\\.*
|
||||||
|
- name: Session
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Session\\.*
|
||||||
|
- name: Throttle
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Throttle\\.*
|
||||||
|
- name: Typography
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Typography\\.*
|
||||||
|
- name: URI
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^CodeIgniter\\HTTP\\URI$
|
||||||
|
- name: Validation
|
||||||
|
collectors:
|
||||||
|
- type: bool
|
||||||
|
must:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Validation\\.*
|
||||||
|
must_not:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\Validation\\FormatRules$
|
||||||
|
- name: View
|
||||||
|
collectors:
|
||||||
|
- type: className
|
||||||
|
regex: ^Codeigniter\\View\\.*
|
||||||
|
ruleset:
|
||||||
|
API:
|
||||||
|
- Format
|
||||||
|
- HTTP
|
||||||
|
Controller:
|
||||||
|
- HTTP
|
||||||
|
- Validation
|
||||||
|
Database:
|
||||||
|
- Entity
|
||||||
|
- Events
|
||||||
|
Email:
|
||||||
|
- Events
|
||||||
|
Entity:
|
||||||
|
- I18n
|
||||||
|
Filters:
|
||||||
|
- HTTP
|
||||||
|
Honeypot:
|
||||||
|
- Filters
|
||||||
|
- HTTP
|
||||||
|
HTTP:
|
||||||
|
- Cookie
|
||||||
|
- Files
|
||||||
|
- Security
|
||||||
|
- URI
|
||||||
|
Images:
|
||||||
|
- Files
|
||||||
|
Model:
|
||||||
|
- Database
|
||||||
|
- I18n
|
||||||
|
- Pager
|
||||||
|
- Validation
|
||||||
|
Pager:
|
||||||
|
- URI
|
||||||
|
- View
|
||||||
|
Publisher:
|
||||||
|
- Files
|
||||||
|
- URI
|
||||||
|
RESTful:
|
||||||
|
- +API
|
||||||
|
- +Controller
|
||||||
|
Router:
|
||||||
|
- HTTP
|
||||||
|
Security:
|
||||||
|
- Cookie
|
||||||
|
- Session
|
||||||
|
- HTTP
|
||||||
|
Session:
|
||||||
|
- Cookie
|
||||||
|
- Database
|
||||||
|
Throttle:
|
||||||
|
- Cache
|
||||||
|
Validation:
|
||||||
|
- HTTP
|
||||||
|
View:
|
||||||
|
- Cache
|
||||||
|
skip_violations:
|
||||||
|
# Individual class exemptions
|
||||||
|
CodeIgniter\Entity\Cast\URICast:
|
||||||
|
- CodeIgniter\HTTP\URI
|
||||||
|
CodeIgniter\Log\Handlers\ChromeLoggerHandler:
|
||||||
|
- CodeIgniter\HTTP\ResponseInterface
|
||||||
|
CodeIgniter\View\Table:
|
||||||
|
- CodeIgniter\Database\BaseResult
|
||||||
|
CodeIgniter\View\Plugins:
|
||||||
|
- CodeIgniter\HTTP\URI
|
||||||
|
|
||||||
|
# BC changes that should be fixed
|
||||||
|
CodeIgniter\HTTP\ResponseTrait:
|
||||||
|
- CodeIgniter\Pager\PagerInterface
|
||||||
|
CodeIgniter\HTTP\ResponseInterface:
|
||||||
|
- CodeIgniter\Pager\PagerInterface
|
||||||
|
CodeIgniter\HTTP\Response:
|
||||||
|
- CodeIgniter\Pager\PagerInterface
|
||||||
|
CodeIgniter\HTTP\RedirectResponse:
|
||||||
|
- CodeIgniter\Pager\PagerInterface
|
||||||
|
CodeIgniter\HTTP\DownloadResponse:
|
||||||
|
- CodeIgniter\Pager\PagerInterface
|
||||||
|
CodeIgniter\Validation\Validation:
|
||||||
|
- CodeIgniter\View\RendererInterface
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: docker/apache/Dockerfile
|
||||||
|
args:
|
||||||
|
uid: ${UID}
|
||||||
|
environment:
|
||||||
|
- APACHE_RUN_USER=#${UID}
|
||||||
|
- APACHE_RUN_GROUP=#${UID}
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./:/var/www/html
|
||||||
|
- ./apache_log:/var/log/apache2
|
||||||
|
ports:
|
||||||
|
- 5101:80
|
||||||
|
volumes:
|
||||||
|
src:
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<VirtualHost *:80>
|
||||||
|
ServerAdmin works@chiefsoft.com
|
||||||
|
ServerName blogdata.chiefsoft.com
|
||||||
|
DocumentRoot /var/www/html/public
|
||||||
|
|
||||||
|
<Directory /var/www/html>
|
||||||
|
Options Indexes FollowSymLinks
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
</VirtualHost>
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
FROM php:7.4-apache
|
||||||
|
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y \
|
||||||
|
git \
|
||||||
|
zip \
|
||||||
|
curl \
|
||||||
|
sudo \
|
||||||
|
unzip \
|
||||||
|
libicu-dev \
|
||||||
|
libbz2-dev \
|
||||||
|
libpng-dev \
|
||||||
|
libjpeg-dev \
|
||||||
|
libmcrypt-dev \
|
||||||
|
libreadline-dev \
|
||||||
|
libfreetype6-dev \
|
||||||
|
g++
|
||||||
|
|
||||||
|
RUN docker-php-ext-install \
|
||||||
|
bz2 \
|
||||||
|
intl \
|
||||||
|
bcmath \
|
||||||
|
opcache \
|
||||||
|
calendar \
|
||||||
|
pdo_mysql \
|
||||||
|
mysqli
|
||||||
|
|
||||||
|
# 2. set up document root for apache
|
||||||
|
COPY docker/apache/000-default.conf /etc/apache2/sites-available/000-default.conf
|
||||||
|
|
||||||
|
# 3. mod_rewrite for URL rewrite and mod_headers for .htaccess extra headers like Access-Control-Allow-Origin-
|
||||||
|
RUN a2enmod rewrite headers
|
||||||
|
|
||||||
|
# 4. start with base php config, then add extensions
|
||||||
|
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
|
||||||
|
|
||||||
|
# 5. Composer
|
||||||
|
RUN curl -sS https://getcomposer.org/installer | php
|
||||||
|
RUN mv composer.phar /usr/local/bin/composer
|
||||||
|
RUN chmod +x /usr/local/bin/composer
|
||||||
|
RUN composer self-update
|
||||||
|
|
||||||
|
COPY / /var/www/html/
|
||||||
|
# 6. we need a user with the same UID/GID with host user
|
||||||
|
# so when we execute CLI commands, all the host file's ownership remains intact
|
||||||
|
# otherwise command from inside container will create root-owned files and directories
|
||||||
|
ARG uid=1000
|
||||||
|
RUN useradd -G www-data,root -u $uid -d /home/devuser devuser
|
||||||
|
RUN mkdir -p /home/devuser/.composer && \
|
||||||
|
chown -R devuser:devuser /home/devuser
|
||||||
|
|
||||||
|
RUN chmod -R +w writable
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
#--------------------------------------------------------------------
|
||||||
|
# Example Environment Configuration file
|
||||||
|
#
|
||||||
|
# This file can be used as a starting point for your own
|
||||||
|
# custom .env files, and contains most of the possible settings
|
||||||
|
# available in a default install.
|
||||||
|
#
|
||||||
|
# By default, all of the settings are commented out. If you want
|
||||||
|
# to override the setting, you must un-comment it by removing the '#'
|
||||||
|
# at the beginning of the line.
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# ENVIRONMENT
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# CI_ENVIRONMENT = production
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# APP
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# app.baseURL = ''
|
||||||
|
# app.forceGlobalSecureRequests = false
|
||||||
|
|
||||||
|
# app.sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler'
|
||||||
|
# app.sessionCookieName = 'ci_session'
|
||||||
|
# app.sessionExpiration = 7200
|
||||||
|
# app.sessionSavePath = null
|
||||||
|
# app.sessionMatchIP = false
|
||||||
|
# app.sessionTimeToUpdate = 300
|
||||||
|
# app.sessionRegenerateDestroy = false
|
||||||
|
|
||||||
|
# app.CSPEnabled = false
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# DATABASE
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# database.default.hostname = localhost
|
||||||
|
# database.default.database = ci4
|
||||||
|
# database.default.username = root
|
||||||
|
# database.default.password = root
|
||||||
|
# database.default.DBDriver = MySQLi
|
||||||
|
# database.default.DBPrefix =
|
||||||
|
|
||||||
|
# database.tests.hostname = localhost
|
||||||
|
# database.tests.database = ci4
|
||||||
|
# database.tests.username = root
|
||||||
|
# database.tests.password = root
|
||||||
|
# database.tests.DBDriver = MySQLi
|
||||||
|
# database.tests.DBPrefix =
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# CONTENT SECURITY POLICY
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# contentsecuritypolicy.reportOnly = false
|
||||||
|
# contentsecuritypolicy.defaultSrc = 'none'
|
||||||
|
# contentsecuritypolicy.scriptSrc = 'self'
|
||||||
|
# contentsecuritypolicy.styleSrc = 'self'
|
||||||
|
# contentsecuritypolicy.imageSrc = 'self'
|
||||||
|
# contentsecuritypolicy.base_uri = null
|
||||||
|
# contentsecuritypolicy.childSrc = null
|
||||||
|
# contentsecuritypolicy.connectSrc = 'self'
|
||||||
|
# contentsecuritypolicy.fontSrc = null
|
||||||
|
# contentsecuritypolicy.formAction = null
|
||||||
|
# contentsecuritypolicy.frameAncestors = null
|
||||||
|
# contentsecuritypolicy.frameSrc = null
|
||||||
|
# contentsecuritypolicy.mediaSrc = null
|
||||||
|
# contentsecuritypolicy.objectSrc = null
|
||||||
|
# contentsecuritypolicy.pluginTypes = null
|
||||||
|
# contentsecuritypolicy.reportURI = null
|
||||||
|
# contentsecuritypolicy.sandbox = false
|
||||||
|
# contentsecuritypolicy.upgradeInsecureRequests = false
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# COOKIE
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# cookie.prefix = ''
|
||||||
|
# cookie.expires = 0
|
||||||
|
# cookie.path = '/'
|
||||||
|
# cookie.domain = ''
|
||||||
|
# cookie.secure = false
|
||||||
|
# cookie.httponly = false
|
||||||
|
# cookie.samesite = 'Lax'
|
||||||
|
# cookie.raw = false
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# ENCRYPTION
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# encryption.key =
|
||||||
|
# encryption.driver = OpenSSL
|
||||||
|
# encryption.blockSize = 16
|
||||||
|
# encryption.digest = SHA512
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# HONEYPOT
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# honeypot.hidden = 'true'
|
||||||
|
# honeypot.label = 'Fill This Field'
|
||||||
|
# honeypot.name = 'honeypot'
|
||||||
|
# honeypot.template = '<label>{label}</label><input type="text" name="{name}" value=""/>'
|
||||||
|
# honeypot.container = '<div style="display:none">{template}</div>'
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# SECURITY
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# security.csrfProtection = 'cookie'
|
||||||
|
# security.tokenRandomize = false
|
||||||
|
# security.tokenName = 'csrf_token_name'
|
||||||
|
# security.headerName = 'X-CSRF-TOKEN'
|
||||||
|
# security.cookieName = 'csrf_cookie_name'
|
||||||
|
# security.expires = 7200
|
||||||
|
# security.regenerate = true
|
||||||
|
# security.redirect = true
|
||||||
|
# security.samesite = 'Lax'
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# LOGGER
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# logger.threshold = 4
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# CURLRequest
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
|
||||||
|
# curlrequest.shareOptions = true
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,49 @@
|
|||||||
|
# Disable directory browsing
|
||||||
|
Options All -Indexes
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Rewrite engine
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Turning on the rewrite engine is necessary for the following rules and features.
|
||||||
|
# FollowSymLinks must be enabled for this to work.
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
Options +FollowSymlinks
|
||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
# If you installed CodeIgniter in a subfolder, you will need to
|
||||||
|
# change the following line to match the subfolder you need.
|
||||||
|
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
|
||||||
|
# RewriteBase /
|
||||||
|
|
||||||
|
# Redirect Trailing Slashes...
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteCond %{REQUEST_URI} (.+)/$
|
||||||
|
RewriteRule ^ %1 [L,R=301]
|
||||||
|
|
||||||
|
# Rewrite "www.example.com -> example.com"
|
||||||
|
RewriteCond %{HTTPS} !=on
|
||||||
|
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
|
||||||
|
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
|
||||||
|
|
||||||
|
# Checks to see if the user is attempting to access a valid file,
|
||||||
|
# such as an image or css document, if this isn't true it sends the
|
||||||
|
# request to the front controller, index.php
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]
|
||||||
|
|
||||||
|
# Ensure Authorization header is passed along
|
||||||
|
RewriteCond %{HTTP:Authorization} .
|
||||||
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfModule !mod_rewrite.c>
|
||||||
|
# If we don't have mod_rewrite installed, all 404's
|
||||||
|
# can be sent to index.php, and everything works as normal.
|
||||||
|
ErrorDocument 404 index.php
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
# Disable server signature start
|
||||||
|
ServerSignature Off
|
||||||
|
# Disable server signature end
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// Path to the front controller (this file)
|
||||||
|
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
|
/*
|
||||||
|
*---------------------------------------------------------------
|
||||||
|
* BOOTSTRAP THE APPLICATION
|
||||||
|
*---------------------------------------------------------------
|
||||||
|
* This process sets up the path constants, loads and registers
|
||||||
|
* our autoloader, along with Composer's, loads our constants
|
||||||
|
* and fires up an environment-specific bootstrapping.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Ensure the current directory is pointing to the front controller's directory
|
||||||
|
chdir(__DIR__);
|
||||||
|
|
||||||
|
// Load our paths config file
|
||||||
|
// This is the line that might need to be changed, depending on your folder structure.
|
||||||
|
$pathsConfig = FCPATH . '../app/Config/Paths.php';
|
||||||
|
// ^^^ Change this if you move your application folder
|
||||||
|
require realpath($pathsConfig) ?: $pathsConfig;
|
||||||
|
|
||||||
|
$paths = new Config\Paths();
|
||||||
|
|
||||||
|
// Location of the framework bootstrap file.
|
||||||
|
$bootstrap = rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';
|
||||||
|
$app = require realpath($bootstrap) ?: $bootstrap;
|
||||||
|
|
||||||
|
/*
|
||||||
|
*---------------------------------------------------------------
|
||||||
|
* LAUNCH THE APPLICATION
|
||||||
|
*---------------------------------------------------------------
|
||||||
|
* Now that everything is setup, it's time to actually fire
|
||||||
|
* up the engines and make this app do its thang.
|
||||||
|
*/
|
||||||
|
$app->run();
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
User-agent: *
|
||||||
|
Disallow:
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* CodeIgniter command-line tools
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* The main entry point into the CLI system and allows you to run
|
||||||
|
* commands and perform maintenance on your application.
|
||||||
|
*
|
||||||
|
* Because CodeIgniter can handle CLI requests as just another web request
|
||||||
|
* this class mainly acts as a passthru to the framework itself.
|
||||||
|
*/
|
||||||
|
|
||||||
|
define('SPARKED', true);
|
||||||
|
|
||||||
|
/*
|
||||||
|
*---------------------------------------------------------------
|
||||||
|
* BOOTSTRAP THE APPLICATION
|
||||||
|
*---------------------------------------------------------------
|
||||||
|
* This process sets up the path constants, loads and registers
|
||||||
|
* our autoloader, along with Composer's, loads our constants
|
||||||
|
* and fires up an environment-specific bootstrapping.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Refuse to run when called from php-cgi
|
||||||
|
if (strpos(PHP_SAPI, 'cgi') === 0) {
|
||||||
|
exit("The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Path to the front controller
|
||||||
|
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
|
// Load our paths config file
|
||||||
|
$pathsConfig = 'app/Config/Paths.php';
|
||||||
|
// ^^^ Change this line if you move your application folder
|
||||||
|
require realpath($pathsConfig) ?: $pathsConfig;
|
||||||
|
|
||||||
|
$paths = new Config\Paths();
|
||||||
|
|
||||||
|
// Ensure the current directory is pointing to the front controller's directory
|
||||||
|
chdir(FCPATH);
|
||||||
|
|
||||||
|
$bootstrap = rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';
|
||||||
|
$app = require realpath($bootstrap) ?: $bootstrap;
|
||||||
|
|
||||||
|
// Grab our Console
|
||||||
|
$console = new CodeIgniter\CLI\Console($app);
|
||||||
|
|
||||||
|
// We want errors to be shown when using it from the CLI.
|
||||||
|
error_reporting(-1);
|
||||||
|
ini_set('display_errors', '1');
|
||||||
|
|
||||||
|
// Show basic information before we do anything else.
|
||||||
|
if (is_int($suppress = array_search('--no-header', $_SERVER['argv'], true))) {
|
||||||
|
unset($_SERVER['argv'][$suppress]); // @codeCoverageIgnore
|
||||||
|
$suppress = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$console->showHeader($suppress);
|
||||||
|
|
||||||
|
// fire off the command in the main framework.
|
||||||
|
$response = $console->run();
|
||||||
|
|
||||||
|
if ($response->getStatusCode() >= 300) {
|
||||||
|
exit($response->getStatusCode());
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<IfModule authz_core_module>
|
||||||
|
Require all denied
|
||||||
|
</IfModule>
|
||||||
|
<IfModule !authz_core_module>
|
||||||
|
Deny from all
|
||||||
|
</IfModule>
|
||||||
@@ -0,0 +1,355 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\API;
|
||||||
|
|
||||||
|
use CodeIgniter\Format\FormatterInterface;
|
||||||
|
use CodeIgniter\HTTP\IncomingRequest;
|
||||||
|
use CodeIgniter\HTTP\Response;
|
||||||
|
use Config\Services;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides common, more readable, methods to provide
|
||||||
|
* consistent HTTP responses under a variety of common
|
||||||
|
* situations when working as an API.
|
||||||
|
*
|
||||||
|
* @property IncomingRequest $request
|
||||||
|
* @property Response $response
|
||||||
|
*/
|
||||||
|
trait ResponseTrait
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Allows child classes to override the
|
||||||
|
* status code that is used in their API.
|
||||||
|
*
|
||||||
|
* @var array<string, int>
|
||||||
|
*/
|
||||||
|
protected $codes = [
|
||||||
|
'created' => 201,
|
||||||
|
'deleted' => 200,
|
||||||
|
'updated' => 200,
|
||||||
|
'no_content' => 204,
|
||||||
|
'invalid_request' => 400,
|
||||||
|
'unsupported_response_type' => 400,
|
||||||
|
'invalid_scope' => 400,
|
||||||
|
'temporarily_unavailable' => 400,
|
||||||
|
'invalid_grant' => 400,
|
||||||
|
'invalid_credentials' => 400,
|
||||||
|
'invalid_refresh' => 400,
|
||||||
|
'no_data' => 400,
|
||||||
|
'invalid_data' => 400,
|
||||||
|
'access_denied' => 401,
|
||||||
|
'unauthorized' => 401,
|
||||||
|
'invalid_client' => 401,
|
||||||
|
'forbidden' => 403,
|
||||||
|
'resource_not_found' => 404,
|
||||||
|
'not_acceptable' => 406,
|
||||||
|
'resource_exists' => 409,
|
||||||
|
'conflict' => 409,
|
||||||
|
'resource_gone' => 410,
|
||||||
|
'payload_too_large' => 413,
|
||||||
|
'unsupported_media_type' => 415,
|
||||||
|
'too_many_requests' => 429,
|
||||||
|
'server_error' => 500,
|
||||||
|
'unsupported_grant_type' => 501,
|
||||||
|
'not_implemented' => 501,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How to format the response data.
|
||||||
|
* Either 'json' or 'xml'. If blank will be
|
||||||
|
* determine through content negotiation.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $format = 'json';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current Formatter instance. This is usually set by ResponseTrait::format
|
||||||
|
*
|
||||||
|
* @var FormatterInterface
|
||||||
|
*/
|
||||||
|
protected $formatter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a single, simple method to return an API response, formatted
|
||||||
|
* to match the requested format, with proper content-type and status code.
|
||||||
|
*
|
||||||
|
* @param array|string|null $data
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
protected function respond($data = null, ?int $status = null, string $message = '')
|
||||||
|
{
|
||||||
|
if ($data === null && $status === null) {
|
||||||
|
$status = 404;
|
||||||
|
$output = null;
|
||||||
|
} elseif ($data === null && is_numeric($status)) {
|
||||||
|
$output = null;
|
||||||
|
} else {
|
||||||
|
$status = empty($status) ? 200 : $status;
|
||||||
|
$output = $this->format($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($output !== null) {
|
||||||
|
if ($this->format === 'json') {
|
||||||
|
return $this->response->setJSON($output)->setStatusCode($status, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->format === 'xml') {
|
||||||
|
return $this->response->setXML($output)->setStatusCode($status, $message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->response->setBody($output)->setStatusCode($status, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for generic failures that no custom methods exist for.
|
||||||
|
*
|
||||||
|
* @param array|string $messages
|
||||||
|
* @param int $status HTTP status code
|
||||||
|
* @param string|null $code Custom, API-specific, error code
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
protected function fail($messages, int $status = 400, ?string $code = null, string $customMessage = '')
|
||||||
|
{
|
||||||
|
if (! is_array($messages)) {
|
||||||
|
$messages = ['error' => $messages];
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = [
|
||||||
|
'status' => $status,
|
||||||
|
'error' => $code ?? $status,
|
||||||
|
'messages' => $messages,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $this->respond($response, $status, $customMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Response Helpers
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used after successfully creating a new resource.
|
||||||
|
*
|
||||||
|
* @param mixed $data
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
protected function respondCreated($data = null, string $message = '')
|
||||||
|
{
|
||||||
|
return $this->respond($data, $this->codes['created'], $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used after a resource has been successfully deleted.
|
||||||
|
*
|
||||||
|
* @param mixed $data
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
protected function respondDeleted($data = null, string $message = '')
|
||||||
|
{
|
||||||
|
return $this->respond($data, $this->codes['deleted'], $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used after a resource has been successfully updated.
|
||||||
|
*
|
||||||
|
* @param mixed $data
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
protected function respondUpdated($data = null, string $message = '')
|
||||||
|
{
|
||||||
|
return $this->respond($data, $this->codes['updated'], $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used after a command has been successfully executed but there is no
|
||||||
|
* meaningful reply to send back to the client.
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
protected function respondNoContent(string $message = 'No Content')
|
||||||
|
{
|
||||||
|
return $this->respond(null, $this->codes['no_content'], $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used when the client is either didn't send authorization information,
|
||||||
|
* or had bad authorization credentials. User is encouraged to try again
|
||||||
|
* with the proper information.
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
protected function failUnauthorized(string $description = 'Unauthorized', ?string $code = null, string $message = '')
|
||||||
|
{
|
||||||
|
return $this->fail($description, $this->codes['unauthorized'], $code, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used when access is always denied to this resource and no amount
|
||||||
|
* of trying again will help.
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
protected function failForbidden(string $description = 'Forbidden', ?string $code = null, string $message = '')
|
||||||
|
{
|
||||||
|
return $this->fail($description, $this->codes['forbidden'], $code, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used when a specified resource cannot be found.
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
protected function failNotFound(string $description = 'Not Found', ?string $code = null, string $message = '')
|
||||||
|
{
|
||||||
|
return $this->fail($description, $this->codes['resource_not_found'], $code, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used when the data provided by the client cannot be validated.
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*
|
||||||
|
* @deprecated Use failValidationErrors instead
|
||||||
|
*/
|
||||||
|
protected function failValidationError(string $description = 'Bad Request', ?string $code = null, string $message = '')
|
||||||
|
{
|
||||||
|
return $this->fail($description, $this->codes['invalid_data'], $code, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used when the data provided by the client cannot be validated on one or more fields.
|
||||||
|
*
|
||||||
|
* @param string|string[] $errors
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
protected function failValidationErrors($errors, ?string $code = null, string $message = '')
|
||||||
|
{
|
||||||
|
return $this->fail($errors, $this->codes['invalid_data'], $code, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use when trying to create a new resource and it already exists.
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
protected function failResourceExists(string $description = 'Conflict', ?string $code = null, string $message = '')
|
||||||
|
{
|
||||||
|
return $this->fail($description, $this->codes['resource_exists'], $code, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use when a resource was previously deleted. This is different than
|
||||||
|
* Not Found, because here we know the data previously existed, but is now gone,
|
||||||
|
* where Not Found means we simply cannot find any information about it.
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
protected function failResourceGone(string $description = 'Gone', ?string $code = null, string $message = '')
|
||||||
|
{
|
||||||
|
return $this->fail($description, $this->codes['resource_gone'], $code, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used when the user has made too many requests for the resource recently.
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
protected function failTooManyRequests(string $description = 'Too Many Requests', ?string $code = null, string $message = '')
|
||||||
|
{
|
||||||
|
return $this->fail($description, $this->codes['too_many_requests'], $code, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used when there is a server error.
|
||||||
|
*
|
||||||
|
* @param string $description The error message to show the user.
|
||||||
|
* @param string|null $code A custom, API-specific, error code.
|
||||||
|
* @param string $message A custom "reason" message to return.
|
||||||
|
*
|
||||||
|
* @return Response The value of the Response's send() method.
|
||||||
|
*/
|
||||||
|
protected function failServerError(string $description = 'Internal Server Error', ?string $code = null, string $message = ''): Response
|
||||||
|
{
|
||||||
|
return $this->fail($description, $this->codes['server_error'], $code, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Utility Methods
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles formatting a response. Currently makes some heavy assumptions
|
||||||
|
* and needs updating! :)
|
||||||
|
*
|
||||||
|
* @param array|string|null $data
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
protected function format($data = null)
|
||||||
|
{
|
||||||
|
// If the data is a string, there's not much we can do to it...
|
||||||
|
if (is_string($data)) {
|
||||||
|
// The content type should be text/... and not application/...
|
||||||
|
$contentType = $this->response->getHeaderLine('Content-Type');
|
||||||
|
$contentType = str_replace('application/json', 'text/html', $contentType);
|
||||||
|
$contentType = str_replace('application/', 'text/', $contentType);
|
||||||
|
$this->response->setContentType($contentType);
|
||||||
|
$this->format = 'html';
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
$format = Services::format();
|
||||||
|
$mime = "application/{$this->format}";
|
||||||
|
|
||||||
|
// Determine correct response type through content negotiation if not explicitly declared
|
||||||
|
if (empty($this->format) || ! in_array($this->format, ['json', 'xml'], true)) {
|
||||||
|
$mime = $this->request->negotiate('media', $format->getConfig()->supportedResponseFormats, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->response->setContentType($mime);
|
||||||
|
|
||||||
|
// if we don't have a formatter, make one
|
||||||
|
if (! isset($this->formatter)) {
|
||||||
|
// if no formatter, use the default
|
||||||
|
$this->formatter = $format->getFormatter($mime);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mime !== 'application/json') {
|
||||||
|
// Recursively convert objects into associative arrays
|
||||||
|
// Conversion not required for JSONFormatter
|
||||||
|
$data = json_decode(json_encode($data), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->formatter->format($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the format the response should be in.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
protected function setResponseFormat(?string $format = null)
|
||||||
|
{
|
||||||
|
$this->format = strtolower($format);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,328 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\Autoloader;
|
||||||
|
|
||||||
|
use Composer\Autoload\ClassLoader;
|
||||||
|
use Config\Autoload;
|
||||||
|
use Config\Modules;
|
||||||
|
use InvalidArgumentException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An autoloader that uses both PSR4 autoloading, and traditional classmaps.
|
||||||
|
*
|
||||||
|
* Given a foo-bar package of classes in the file system at the following paths:
|
||||||
|
* ```
|
||||||
|
* /path/to/packages/foo-bar/
|
||||||
|
* /src
|
||||||
|
* Baz.php # Foo\Bar\Baz
|
||||||
|
* Qux/
|
||||||
|
* Quux.php # Foo\Bar\Qux\Quux
|
||||||
|
* ```
|
||||||
|
* you can add the path to the configuration array that is passed in the constructor.
|
||||||
|
* The Config array consists of 2 primary keys, both of which are associative arrays:
|
||||||
|
* 'psr4', and 'classmap'.
|
||||||
|
* ```
|
||||||
|
* $Config = [
|
||||||
|
* 'psr4' => [
|
||||||
|
* 'Foo\Bar' => '/path/to/packages/foo-bar'
|
||||||
|
* ],
|
||||||
|
* 'classmap' => [
|
||||||
|
* 'MyClass' => '/path/to/class/file.php'
|
||||||
|
* ]
|
||||||
|
* ];
|
||||||
|
* ```
|
||||||
|
* Example:
|
||||||
|
* ```
|
||||||
|
* <?php
|
||||||
|
* // our configuration array
|
||||||
|
* $Config = [ ... ];
|
||||||
|
* $loader = new \CodeIgniter\Autoloader\Autoloader($Config);
|
||||||
|
*
|
||||||
|
* // register the autoloader
|
||||||
|
* $loader->register();
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
class Autoloader
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Stores namespaces as key, and path as values.
|
||||||
|
*
|
||||||
|
* @var array<string, array<string>>
|
||||||
|
*/
|
||||||
|
protected $prefixes = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores class name as key, and path as values.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
protected $classmap = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores files as a list.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $files = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads in the configuration array (described above) and stores
|
||||||
|
* the valid parts that we'll need.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function initialize(Autoload $config, Modules $modules)
|
||||||
|
{
|
||||||
|
// We have to have one or the other, though we don't enforce the need
|
||||||
|
// to have both present in order to work.
|
||||||
|
if (empty($config->psr4) && empty($config->classmap)) {
|
||||||
|
throw new InvalidArgumentException('Config array must contain either the \'psr4\' key or the \'classmap\' key.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($config->psr4)) {
|
||||||
|
$this->addNamespace($config->psr4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($config->classmap)) {
|
||||||
|
$this->classmap = $config->classmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($config->files)) {
|
||||||
|
$this->files = $config->files;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Should we load through Composer's namespaces, also?
|
||||||
|
if ($modules->discoverInComposer) {
|
||||||
|
$this->discoverComposerNamespaces();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the loader with the SPL autoloader stack.
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
// Prepend the PSR4 autoloader for maximum performance.
|
||||||
|
spl_autoload_register([$this, 'loadClass'], true, true);
|
||||||
|
|
||||||
|
// Now prepend another loader for the files in our class map.
|
||||||
|
spl_autoload_register([$this, 'loadClassmap'], true, true);
|
||||||
|
|
||||||
|
// Load our non-class files
|
||||||
|
foreach ($this->files as $file) {
|
||||||
|
if (is_string($file)) {
|
||||||
|
$this->includeFile($file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers namespaces with the autoloader.
|
||||||
|
*
|
||||||
|
* @param array|string $namespace
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function addNamespace($namespace, ?string $path = null)
|
||||||
|
{
|
||||||
|
if (is_array($namespace)) {
|
||||||
|
foreach ($namespace as $prefix => $namespacedPath) {
|
||||||
|
$prefix = trim($prefix, '\\');
|
||||||
|
|
||||||
|
if (is_array($namespacedPath)) {
|
||||||
|
foreach ($namespacedPath as $dir) {
|
||||||
|
$this->prefixes[$prefix][] = rtrim($dir, '\\/') . DIRECTORY_SEPARATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->prefixes[$prefix][] = rtrim($namespacedPath, '\\/') . DIRECTORY_SEPARATOR;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->prefixes[trim($namespace, '\\')][] = rtrim($path, '\\/') . DIRECTORY_SEPARATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get namespaces with prefixes as keys and paths as values.
|
||||||
|
*
|
||||||
|
* If a prefix param is set, returns only paths to the given prefix.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getNamespace(?string $prefix = null)
|
||||||
|
{
|
||||||
|
if ($prefix === null) {
|
||||||
|
return $this->prefixes;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->prefixes[trim($prefix, '\\')] ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a single namespace from the psr4 settings.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function removeNamespace(string $namespace)
|
||||||
|
{
|
||||||
|
if (isset($this->prefixes[trim($namespace, '\\')])) {
|
||||||
|
unset($this->prefixes[trim($namespace, '\\')]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a class using available class mapping.
|
||||||
|
*
|
||||||
|
* @return false|string
|
||||||
|
*/
|
||||||
|
public function loadClassmap(string $class)
|
||||||
|
{
|
||||||
|
$file = $this->classmap[$class] ?? '';
|
||||||
|
|
||||||
|
if (is_string($file) && $file !== '') {
|
||||||
|
return $this->includeFile($file);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the class file for a given class name.
|
||||||
|
*
|
||||||
|
* @param string $class The fully qualified class name.
|
||||||
|
*
|
||||||
|
* @return false|string The mapped file on success, or boolean false
|
||||||
|
* on failure.
|
||||||
|
*/
|
||||||
|
public function loadClass(string $class)
|
||||||
|
{
|
||||||
|
$class = trim($class, '\\');
|
||||||
|
$class = str_ireplace('.php', '', $class);
|
||||||
|
|
||||||
|
return $this->loadInNamespace($class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the class file for a given class name.
|
||||||
|
*
|
||||||
|
* @param string $class The fully-qualified class name
|
||||||
|
*
|
||||||
|
* @return false|string The mapped file name on success, or boolean false on fail
|
||||||
|
*/
|
||||||
|
protected function loadInNamespace(string $class)
|
||||||
|
{
|
||||||
|
if (strpos($class, '\\') === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->prefixes as $namespace => $directories) {
|
||||||
|
foreach ($directories as $directory) {
|
||||||
|
$directory = rtrim($directory, '\\/');
|
||||||
|
|
||||||
|
if (strpos($class, $namespace) === 0) {
|
||||||
|
$filePath = $directory . str_replace('\\', DIRECTORY_SEPARATOR, substr($class, strlen($namespace))) . '.php';
|
||||||
|
$filename = $this->includeFile($filePath);
|
||||||
|
|
||||||
|
if ($filename) {
|
||||||
|
return $filename;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// never found a mapped file
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A central way to include a file. Split out primarily for testing purposes.
|
||||||
|
*
|
||||||
|
* @return false|string The filename on success, false if the file is not loaded
|
||||||
|
*/
|
||||||
|
protected function includeFile(string $file)
|
||||||
|
{
|
||||||
|
$file = $this->sanitizeFilename($file);
|
||||||
|
|
||||||
|
if (is_file($file)) {
|
||||||
|
include_once $file;
|
||||||
|
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitizes a filename, replacing spaces with dashes.
|
||||||
|
*
|
||||||
|
* Removes special characters that are illegal in filenames on certain
|
||||||
|
* operating systems and special characters requiring special escaping
|
||||||
|
* to manipulate at the command line. Replaces spaces and consecutive
|
||||||
|
* dashes with a single dash. Trim period, dash and underscore from beginning
|
||||||
|
* and end of filename.
|
||||||
|
*
|
||||||
|
* @return string The sanitized filename
|
||||||
|
*/
|
||||||
|
public function sanitizeFilename(string $filename): string
|
||||||
|
{
|
||||||
|
// Only allow characters deemed safe for POSIX portable filenames.
|
||||||
|
// Plus the forward slash for directory separators since this might be a path.
|
||||||
|
// http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_278
|
||||||
|
// Modified to allow backslash and colons for on Windows machines.
|
||||||
|
$filename = preg_replace('/[^0-9\p{L}\s\/\-\_\.\:\\\\]/u', '', $filename);
|
||||||
|
|
||||||
|
// Clean up our filename edges.
|
||||||
|
return trim($filename, '.-_');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locates autoload information from Composer, if available.
|
||||||
|
*/
|
||||||
|
protected function discoverComposerNamespaces()
|
||||||
|
{
|
||||||
|
if (! is_file(COMPOSER_PATH)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ClassLoader $composer
|
||||||
|
*/
|
||||||
|
$composer = include COMPOSER_PATH;
|
||||||
|
$paths = $composer->getPrefixesPsr4();
|
||||||
|
$classes = $composer->getClassMap();
|
||||||
|
|
||||||
|
unset($composer);
|
||||||
|
|
||||||
|
// Get rid of CodeIgniter so we don't have duplicates
|
||||||
|
if (isset($paths['CodeIgniter\\'])) {
|
||||||
|
unset($paths['CodeIgniter\\']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$newPaths = [];
|
||||||
|
|
||||||
|
foreach ($paths as $key => $value) {
|
||||||
|
// Composer stores namespaces with trailing slash. We don't.
|
||||||
|
$newPaths[rtrim($key, '\\ ')] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->prefixes = array_merge($this->prefixes, $newPaths);
|
||||||
|
$this->classmap = array_merge($this->classmap, $classes);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,369 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\Autoloader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows loading non-class files in a namespaced manner.
|
||||||
|
* Works with Helpers, Views, etc.
|
||||||
|
*/
|
||||||
|
class FileLocator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Autoloader to use.
|
||||||
|
*
|
||||||
|
* @var Autoloader
|
||||||
|
*/
|
||||||
|
protected $autoloader;
|
||||||
|
|
||||||
|
public function __construct(Autoloader $autoloader)
|
||||||
|
{
|
||||||
|
$this->autoloader = $autoloader;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to locate a file by examining the name for a namespace
|
||||||
|
* and looking through the PSR-4 namespaced files that we know about.
|
||||||
|
*
|
||||||
|
* @param string $file The namespaced file to locate
|
||||||
|
* @param string|null $folder The folder within the namespace that we should look for the file.
|
||||||
|
* @param string $ext The file extension the file should have.
|
||||||
|
*
|
||||||
|
* @return false|string The path to the file, or false if not found.
|
||||||
|
*/
|
||||||
|
public function locateFile(string $file, ?string $folder = null, string $ext = 'php')
|
||||||
|
{
|
||||||
|
$file = $this->ensureExt($file, $ext);
|
||||||
|
|
||||||
|
// Clears the folder name if it is at the beginning of the filename
|
||||||
|
if (! empty($folder) && strpos($file, $folder) === 0) {
|
||||||
|
$file = substr($file, strlen($folder . '/'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Is not namespaced? Try the application folder.
|
||||||
|
if (strpos($file, '\\') === false) {
|
||||||
|
return $this->legacyLocate($file, $folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Standardize slashes to handle nested directories.
|
||||||
|
$file = strtr($file, '/', '\\');
|
||||||
|
$file = ltrim($file, '\\');
|
||||||
|
|
||||||
|
$segments = explode('\\', $file);
|
||||||
|
|
||||||
|
// The first segment will be empty if a slash started the filename.
|
||||||
|
if (empty($segments[0])) {
|
||||||
|
unset($segments[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$paths = [];
|
||||||
|
$filename = '';
|
||||||
|
|
||||||
|
// Namespaces always comes with arrays of paths
|
||||||
|
$namespaces = $this->autoloader->getNamespace();
|
||||||
|
|
||||||
|
foreach (array_keys($namespaces) as $namespace) {
|
||||||
|
if (substr($file, 0, strlen($namespace)) === $namespace) {
|
||||||
|
// There may be sub-namespaces of the same vendor,
|
||||||
|
// so overwrite them with namespaces found later.
|
||||||
|
$paths = $namespaces[$namespace];
|
||||||
|
|
||||||
|
$fileWithoutNamespace = substr($file, strlen($namespace));
|
||||||
|
$filename = ltrim(str_replace('\\', '/', $fileWithoutNamespace), '/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if no namespaces matched then quit
|
||||||
|
if (empty($paths)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check each path in the namespace
|
||||||
|
foreach ($paths as $path) {
|
||||||
|
// Ensure trailing slash
|
||||||
|
$path = rtrim($path, '/') . '/';
|
||||||
|
|
||||||
|
// If we have a folder name, then the calling function
|
||||||
|
// expects this file to be within that folder, like 'Views',
|
||||||
|
// or 'libraries'.
|
||||||
|
if (! empty($folder) && strpos($path . $filename, '/' . $folder . '/') === false) {
|
||||||
|
$path .= trim($folder, '/') . '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
$path .= $filename;
|
||||||
|
if (is_file($path)) {
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Examines a file and returns the fully qualified domain name.
|
||||||
|
*/
|
||||||
|
public function getClassname(string $file): string
|
||||||
|
{
|
||||||
|
$php = file_get_contents($file);
|
||||||
|
$tokens = token_get_all($php);
|
||||||
|
$dlm = false;
|
||||||
|
$namespace = '';
|
||||||
|
$className = '';
|
||||||
|
|
||||||
|
foreach ($tokens as $i => $token) {
|
||||||
|
if ($i < 2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((isset($tokens[$i - 2][1]) && ($tokens[$i - 2][1] === 'phpnamespace' || $tokens[$i - 2][1] === 'namespace')) || ($dlm && $tokens[$i - 1][0] === T_NS_SEPARATOR && $token[0] === T_STRING)) {
|
||||||
|
if (! $dlm) {
|
||||||
|
$namespace = 0;
|
||||||
|
}
|
||||||
|
if (isset($token[1])) {
|
||||||
|
$namespace = $namespace ? $namespace . '\\' . $token[1] : $token[1];
|
||||||
|
$dlm = true;
|
||||||
|
}
|
||||||
|
} elseif ($dlm && ($token[0] !== T_NS_SEPARATOR) && ($token[0] !== T_STRING)) {
|
||||||
|
$dlm = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($tokens[$i - 2][0] === T_CLASS || (isset($tokens[$i - 2][1]) && $tokens[$i - 2][1] === 'phpclass'))
|
||||||
|
&& $tokens[$i - 1][0] === T_WHITESPACE
|
||||||
|
&& $token[0] === T_STRING) {
|
||||||
|
$className = $token[1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($className)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $namespace . '\\' . $className;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searches through all of the defined namespaces looking for a file.
|
||||||
|
* Returns an array of all found locations for the defined file.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* $locator->search('Config/Routes.php');
|
||||||
|
* // Assuming PSR4 namespaces include foo and bar, might return:
|
||||||
|
* [
|
||||||
|
* 'app/Modules/foo/Config/Routes.php',
|
||||||
|
* 'app/Modules/bar/Config/Routes.php',
|
||||||
|
* ]
|
||||||
|
*/
|
||||||
|
public function search(string $path, string $ext = 'php', bool $prioritizeApp = true): array
|
||||||
|
{
|
||||||
|
$path = $this->ensureExt($path, $ext);
|
||||||
|
|
||||||
|
$foundPaths = [];
|
||||||
|
$appPaths = [];
|
||||||
|
|
||||||
|
foreach ($this->getNamespaces() as $namespace) {
|
||||||
|
if (isset($namespace['path']) && is_file($namespace['path'] . $path)) {
|
||||||
|
$fullPath = $namespace['path'] . $path;
|
||||||
|
$fullPath = realpath($fullPath) ?: $fullPath;
|
||||||
|
|
||||||
|
if ($prioritizeApp) {
|
||||||
|
$foundPaths[] = $fullPath;
|
||||||
|
} elseif (strpos($fullPath, APPPATH) === 0) {
|
||||||
|
$appPaths[] = $fullPath;
|
||||||
|
} else {
|
||||||
|
$foundPaths[] = $fullPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $prioritizeApp && ! empty($appPaths)) {
|
||||||
|
$foundPaths = array_merge($foundPaths, $appPaths);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove any duplicates
|
||||||
|
return array_unique($foundPaths);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensures a extension is at the end of a filename
|
||||||
|
*/
|
||||||
|
protected function ensureExt(string $path, string $ext): string
|
||||||
|
{
|
||||||
|
if ($ext) {
|
||||||
|
$ext = '.' . $ext;
|
||||||
|
|
||||||
|
if (substr($path, -strlen($ext)) !== $ext) {
|
||||||
|
$path .= $ext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the namespace mappings we know about.
|
||||||
|
*
|
||||||
|
* @return array|string
|
||||||
|
*/
|
||||||
|
protected function getNamespaces()
|
||||||
|
{
|
||||||
|
$namespaces = [];
|
||||||
|
|
||||||
|
// Save system for last
|
||||||
|
$system = [];
|
||||||
|
|
||||||
|
foreach ($this->autoloader->getNamespace() as $prefix => $paths) {
|
||||||
|
foreach ($paths as $path) {
|
||||||
|
if ($prefix === 'CodeIgniter') {
|
||||||
|
$system = [
|
||||||
|
'prefix' => $prefix,
|
||||||
|
'path' => rtrim($path, '\\/') . DIRECTORY_SEPARATOR,
|
||||||
|
];
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$namespaces[] = [
|
||||||
|
'prefix' => $prefix,
|
||||||
|
'path' => rtrim($path, '\\/') . DIRECTORY_SEPARATOR,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$namespaces[] = $system;
|
||||||
|
|
||||||
|
return $namespaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the qualified name of a file according to
|
||||||
|
* the namespace of the first matched namespace path.
|
||||||
|
*
|
||||||
|
* @return false|string The qualified name or false if the path is not found
|
||||||
|
*/
|
||||||
|
public function findQualifiedNameFromPath(string $path)
|
||||||
|
{
|
||||||
|
$path = realpath($path) ?: $path;
|
||||||
|
|
||||||
|
if (! is_file($path)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->getNamespaces() as $namespace) {
|
||||||
|
$namespace['path'] = realpath($namespace['path']) ?: $namespace['path'];
|
||||||
|
|
||||||
|
if (empty($namespace['path'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mb_strpos($path, $namespace['path']) === 0) {
|
||||||
|
$className = '\\' . $namespace['prefix'] . '\\' .
|
||||||
|
ltrim(str_replace(
|
||||||
|
'/',
|
||||||
|
'\\',
|
||||||
|
mb_substr($path, mb_strlen($namespace['path']))
|
||||||
|
), '\\');
|
||||||
|
|
||||||
|
// Remove the file extension (.php)
|
||||||
|
$className = mb_substr($className, 0, -4);
|
||||||
|
|
||||||
|
// Check if this exists
|
||||||
|
if (class_exists($className)) {
|
||||||
|
return $className;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scans the defined namespaces, returning a list of all files
|
||||||
|
* that are contained within the subpath specified by $path.
|
||||||
|
*/
|
||||||
|
public function listFiles(string $path): array
|
||||||
|
{
|
||||||
|
if (empty($path)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$files = [];
|
||||||
|
helper('filesystem');
|
||||||
|
|
||||||
|
foreach ($this->getNamespaces() as $namespace) {
|
||||||
|
$fullPath = $namespace['path'] . $path;
|
||||||
|
$fullPath = realpath($fullPath) ?: $fullPath;
|
||||||
|
|
||||||
|
if (! is_dir($fullPath)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tempFiles = get_filenames($fullPath, true);
|
||||||
|
|
||||||
|
if (! empty($tempFiles)) {
|
||||||
|
$files = array_merge($files, $tempFiles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $files;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scans the provided namespace, returning a list of all files
|
||||||
|
* that are contained within the subpath specified by $path.
|
||||||
|
*/
|
||||||
|
public function listNamespaceFiles(string $prefix, string $path): array
|
||||||
|
{
|
||||||
|
if (empty($path) || empty($prefix)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$files = [];
|
||||||
|
helper('filesystem');
|
||||||
|
|
||||||
|
// autoloader->getNamespace($prefix) returns an array of paths for that namespace
|
||||||
|
foreach ($this->autoloader->getNamespace($prefix) as $namespacePath) {
|
||||||
|
$fullPath = rtrim($namespacePath, '/') . '/' . $path;
|
||||||
|
$fullPath = realpath($fullPath) ?: $fullPath;
|
||||||
|
|
||||||
|
if (! is_dir($fullPath)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tempFiles = get_filenames($fullPath, true);
|
||||||
|
|
||||||
|
if (! empty($tempFiles)) {
|
||||||
|
$files = array_merge($files, $tempFiles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $files;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the app folder to see if the file can be found.
|
||||||
|
* Only for use with filenames that DO NOT include namespacing.
|
||||||
|
*
|
||||||
|
* @return false|string The path to the file, or false if not found.
|
||||||
|
*/
|
||||||
|
protected function legacyLocate(string $file, ?string $folder = null)
|
||||||
|
{
|
||||||
|
$path = APPPATH . (empty($folder) ? $file : $folder . '/' . $file);
|
||||||
|
$path = realpath($path) ?: $path;
|
||||||
|
|
||||||
|
if (is_file($path)) {
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,219 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\CLI;
|
||||||
|
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
use ReflectionException;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BaseCommand is the base class used in creating CLI commands.
|
||||||
|
*
|
||||||
|
* @property array $arguments
|
||||||
|
* @property Commands $commands
|
||||||
|
* @property string $description
|
||||||
|
* @property string $group
|
||||||
|
* @property LoggerInterface $logger
|
||||||
|
* @property string $name
|
||||||
|
* @property array $options
|
||||||
|
* @property string $usage
|
||||||
|
*/
|
||||||
|
abstract class BaseCommand
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The group the command is lumped under
|
||||||
|
* when listing commands.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $group;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Command's name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the Command's usage description
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $usage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the Command's short description
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the Command's options description
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $options = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the Command's Arguments description
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $arguments = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Logger to use for a command
|
||||||
|
*
|
||||||
|
* @var LoggerInterface
|
||||||
|
*/
|
||||||
|
protected $logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instance of Commands so
|
||||||
|
* commands can call other commands.
|
||||||
|
*
|
||||||
|
* @var Commands
|
||||||
|
*/
|
||||||
|
protected $commands;
|
||||||
|
|
||||||
|
public function __construct(LoggerInterface $logger, Commands $commands)
|
||||||
|
{
|
||||||
|
$this->logger = $logger;
|
||||||
|
$this->commands = $commands;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actually execute a command.
|
||||||
|
*
|
||||||
|
* @param array<string, mixed> $params
|
||||||
|
*/
|
||||||
|
abstract public function run(array $params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be used by a command to run other commands.
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
protected function call(string $command, array $params = [])
|
||||||
|
{
|
||||||
|
return $this->commands->run($command, $params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple method to display an error with line/file, in child commands.
|
||||||
|
*/
|
||||||
|
protected function showError(Throwable $e)
|
||||||
|
{
|
||||||
|
$exception = $e;
|
||||||
|
$message = $e->getMessage();
|
||||||
|
|
||||||
|
require APPPATH . 'Views/errors/cli/error_exception.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show Help includes (Usage, Arguments, Description, Options).
|
||||||
|
*/
|
||||||
|
public function showHelp()
|
||||||
|
{
|
||||||
|
CLI::write(lang('CLI.helpUsage'), 'yellow');
|
||||||
|
|
||||||
|
if (! empty($this->usage)) {
|
||||||
|
$usage = $this->usage;
|
||||||
|
} else {
|
||||||
|
$usage = $this->name;
|
||||||
|
|
||||||
|
if (! empty($this->arguments)) {
|
||||||
|
$usage .= ' [arguments]';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CLI::write($this->setPad($usage, 0, 0, 2));
|
||||||
|
|
||||||
|
if (! empty($this->description)) {
|
||||||
|
CLI::newLine();
|
||||||
|
CLI::write(lang('CLI.helpDescription'), 'yellow');
|
||||||
|
CLI::write($this->setPad($this->description, 0, 0, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($this->arguments)) {
|
||||||
|
CLI::newLine();
|
||||||
|
CLI::write(lang('CLI.helpArguments'), 'yellow');
|
||||||
|
$length = max(array_map('strlen', array_keys($this->arguments)));
|
||||||
|
|
||||||
|
foreach ($this->arguments as $argument => $description) {
|
||||||
|
CLI::write(CLI::color($this->setPad($argument, $length, 2, 2), 'green') . $description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($this->options)) {
|
||||||
|
CLI::newLine();
|
||||||
|
CLI::write(lang('CLI.helpOptions'), 'yellow');
|
||||||
|
$length = max(array_map('strlen', array_keys($this->options)));
|
||||||
|
|
||||||
|
foreach ($this->options as $option => $description) {
|
||||||
|
CLI::write(CLI::color($this->setPad($option, $length, 2, 2), 'green') . $description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pads our string out so that all titles are the same length to nicely line up descriptions.
|
||||||
|
*
|
||||||
|
* @param int $extra How many extra spaces to add at the end
|
||||||
|
*/
|
||||||
|
public function setPad(string $item, int $max, int $extra = 2, int $indent = 0): string
|
||||||
|
{
|
||||||
|
$max += $extra + $indent;
|
||||||
|
|
||||||
|
return str_pad(str_repeat(' ', $indent) . $item, $max);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get pad for $key => $value array output
|
||||||
|
*
|
||||||
|
* @deprecated Use setPad() instead.
|
||||||
|
*
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
*/
|
||||||
|
public function getPad(array $array, int $pad): int
|
||||||
|
{
|
||||||
|
$max = 0;
|
||||||
|
|
||||||
|
foreach (array_keys($array) as $key) {
|
||||||
|
$max = max($max, strlen($key));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $max + $pad;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes it simple to access our protected properties.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function __get(string $key)
|
||||||
|
{
|
||||||
|
return $this->{$key} ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes it simple to check our protected properties.
|
||||||
|
*/
|
||||||
|
public function __isset(string $key): bool
|
||||||
|
{
|
||||||
|
return isset($this->{$key});
|
||||||
|
}
|
||||||
|
}
|
||||||
+1000
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\CLI;
|
||||||
|
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
use Config\Services;
|
||||||
|
use ReflectionException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command runner
|
||||||
|
*/
|
||||||
|
class CommandRunner extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Instance of class managing the collection of commands
|
||||||
|
*
|
||||||
|
* @var Commands
|
||||||
|
*/
|
||||||
|
protected $commands;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->commands = Services::commands();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We map all un-routed CLI methods through this function
|
||||||
|
* so we have the chance to look for a Command first.
|
||||||
|
*
|
||||||
|
* @param string $method
|
||||||
|
* @param array ...$params
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function _remap($method, ...$params)
|
||||||
|
{
|
||||||
|
// The first param is usually empty, so scrap it.
|
||||||
|
if (empty($params[0])) {
|
||||||
|
array_shift($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->index($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default command.
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function index(array $params)
|
||||||
|
{
|
||||||
|
$command = array_shift($params) ?? 'list';
|
||||||
|
|
||||||
|
return $this->commands->run($command, $params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows access to the current commands that have been found.
|
||||||
|
*/
|
||||||
|
public function getCommands(): array
|
||||||
|
{
|
||||||
|
return $this->commands->getCommands();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\CLI;
|
||||||
|
|
||||||
|
use CodeIgniter\Autoloader\FileLocator;
|
||||||
|
use CodeIgniter\Log\Logger;
|
||||||
|
use ReflectionClass;
|
||||||
|
use ReflectionException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Core functionality for running, listing, etc commands.
|
||||||
|
*/
|
||||||
|
class Commands
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The found commands.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $commands = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logger instance.
|
||||||
|
*
|
||||||
|
* @var Logger
|
||||||
|
*/
|
||||||
|
protected $logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param Logger|null $logger
|
||||||
|
*/
|
||||||
|
public function __construct($logger = null)
|
||||||
|
{
|
||||||
|
$this->logger = $logger ?? service('logger');
|
||||||
|
$this->discoverCommands();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs a command given
|
||||||
|
*/
|
||||||
|
public function run(string $command, array $params)
|
||||||
|
{
|
||||||
|
if (! $this->verifyCommand($command, $this->commands)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The file would have already been loaded during the
|
||||||
|
// createCommandList function...
|
||||||
|
$className = $this->commands[$command]['class'];
|
||||||
|
$class = new $className($this->logger, $this);
|
||||||
|
|
||||||
|
return $class->run($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provide access to the list of commands.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getCommands()
|
||||||
|
{
|
||||||
|
return $this->commands;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Discovers all commands in the framework and within user code,
|
||||||
|
* and collects instances of them to work with.
|
||||||
|
*/
|
||||||
|
public function discoverCommands()
|
||||||
|
{
|
||||||
|
if ($this->commands !== []) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var FileLocator $locator */
|
||||||
|
$locator = service('locator');
|
||||||
|
$files = $locator->listFiles('Commands/');
|
||||||
|
|
||||||
|
// If no matching command files were found, bail
|
||||||
|
// This should never happen in unit testing.
|
||||||
|
if ($files === []) {
|
||||||
|
return; // @codeCoverageIgnore
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop over each file checking to see if a command with that
|
||||||
|
// alias exists in the class.
|
||||||
|
foreach ($files as $file) {
|
||||||
|
$className = $locator->findQualifiedNameFromPath($file);
|
||||||
|
|
||||||
|
if (empty($className) || ! class_exists($className)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$class = new ReflectionClass($className);
|
||||||
|
|
||||||
|
if (! $class->isInstantiable() || ! $class->isSubclassOf(BaseCommand::class)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var BaseCommand $class */
|
||||||
|
$class = new $className($this->logger, $this);
|
||||||
|
|
||||||
|
if (isset($class->group)) {
|
||||||
|
$this->commands[$class->name] = [
|
||||||
|
'class' => $className,
|
||||||
|
'file' => $file,
|
||||||
|
'group' => $class->group,
|
||||||
|
'description' => $class->description,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($class);
|
||||||
|
} catch (ReflectionException $e) {
|
||||||
|
$this->logger->error($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
asort($this->commands);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies if the command being sought is found
|
||||||
|
* in the commands list.
|
||||||
|
*/
|
||||||
|
public function verifyCommand(string $command, array $commands): bool
|
||||||
|
{
|
||||||
|
if (isset($commands[$command])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$message = lang('CLI.commandNotFound', [$command]);
|
||||||
|
|
||||||
|
if ($alternatives = $this->getCommandAlternatives($command, $commands)) {
|
||||||
|
if (count($alternatives) === 1) {
|
||||||
|
$message .= "\n\n" . lang('CLI.altCommandSingular') . "\n ";
|
||||||
|
} else {
|
||||||
|
$message .= "\n\n" . lang('CLI.altCommandPlural') . "\n ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$message .= implode("\n ", $alternatives);
|
||||||
|
}
|
||||||
|
|
||||||
|
CLI::error($message);
|
||||||
|
CLI::newLine();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds alternative of `$name` among collection
|
||||||
|
* of commands.
|
||||||
|
*/
|
||||||
|
protected function getCommandAlternatives(string $name, array $collection): array
|
||||||
|
{
|
||||||
|
$alternatives = [];
|
||||||
|
|
||||||
|
foreach (array_keys($collection) as $commandName) {
|
||||||
|
$lev = levenshtein($name, $commandName);
|
||||||
|
|
||||||
|
if ($lev <= strlen($commandName) / 3 || strpos($commandName, $name) !== false) {
|
||||||
|
$alternatives[$commandName] = $lev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ksort($alternatives, SORT_NATURAL | SORT_FLAG_CASE);
|
||||||
|
|
||||||
|
return array_keys($alternatives);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\CLI;
|
||||||
|
|
||||||
|
use CodeIgniter\CodeIgniter;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Console
|
||||||
|
*/
|
||||||
|
class Console
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Main CodeIgniter instance.
|
||||||
|
*
|
||||||
|
* @var CodeIgniter
|
||||||
|
*/
|
||||||
|
protected $app;
|
||||||
|
|
||||||
|
public function __construct(CodeIgniter $app)
|
||||||
|
{
|
||||||
|
$this->app = $app;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the current command discovered on the CLI.
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function run(bool $useSafeOutput = false)
|
||||||
|
{
|
||||||
|
$path = CLI::getURI() ?: 'list';
|
||||||
|
|
||||||
|
// Set the path for the application to route to.
|
||||||
|
$this->app->setPath("ci{$path}");
|
||||||
|
|
||||||
|
return $this->app->useSafeOutput($useSafeOutput)->run();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays basic information about the Console.
|
||||||
|
*/
|
||||||
|
public function showHeader(bool $suppress = false)
|
||||||
|
{
|
||||||
|
if ($suppress) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CLI::write(sprintf('CodeIgniter v%s Command Line Tool - Server Time: %s UTC%s', CodeIgniter::CI_VERSION, date('Y-m-d H:i:s'), date('P')), 'green');
|
||||||
|
CLI::newLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\CLI\Exceptions;
|
||||||
|
|
||||||
|
use CodeIgniter\Exceptions\DebugTraceableTrait;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CLIException
|
||||||
|
*/
|
||||||
|
class CLIException extends RuntimeException
|
||||||
|
{
|
||||||
|
use DebugTraceableTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown when `$color` specified for `$type` is not within the
|
||||||
|
* allowed list of colors.
|
||||||
|
*
|
||||||
|
* @return CLIException
|
||||||
|
*/
|
||||||
|
public static function forInvalidColor(string $type, string $color)
|
||||||
|
{
|
||||||
|
return new static(lang('CLI.invalidColor', [$type, $color]));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,352 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\CLI;
|
||||||
|
|
||||||
|
use Config\Services;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GeneratorTrait contains a collection of methods
|
||||||
|
* to build the commands that generates a file.
|
||||||
|
*/
|
||||||
|
trait GeneratorTrait
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Component Name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File directory
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $directory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View template name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $template;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Language string key for required class names.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $classNameLang = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to require class name.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $hasClassName = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to sort class imports.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $sortImports = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the `--suffix` option has any effect.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $enabledSuffixing = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The params array for easy access by other methods.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $params = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the command.
|
||||||
|
*/
|
||||||
|
protected function execute(array $params): void
|
||||||
|
{
|
||||||
|
$this->params = $params;
|
||||||
|
|
||||||
|
if ($this->getOption('namespace') === 'CodeIgniter') {
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
|
CLI::write(lang('CLI.generator.usingCINamespace'), 'yellow');
|
||||||
|
CLI::newLine();
|
||||||
|
|
||||||
|
if (CLI::prompt('Are you sure you want to continue?', ['y', 'n'], 'required') === 'n') {
|
||||||
|
CLI::newLine();
|
||||||
|
CLI::write(lang('CLI.generator.cancelOperation'), 'yellow');
|
||||||
|
CLI::newLine();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CLI::newLine();
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the fully qualified class name from the input.
|
||||||
|
$class = $this->qualifyClassName();
|
||||||
|
|
||||||
|
// Get the file path from class name.
|
||||||
|
$path = $this->buildPath($class);
|
||||||
|
|
||||||
|
// Check if path is empty.
|
||||||
|
if (empty($path)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$isFile = is_file($path);
|
||||||
|
|
||||||
|
// Overwriting files unknowingly is a serious annoyance, So we'll check if
|
||||||
|
// we are duplicating things, If 'force' option is not supplied, we bail.
|
||||||
|
if (! $this->getOption('force') && $isFile) {
|
||||||
|
CLI::error(lang('CLI.generator.fileExist', [clean_path($path)]), 'light_gray', 'red');
|
||||||
|
CLI::newLine();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the directory to save the file is existing.
|
||||||
|
$dir = dirname($path);
|
||||||
|
|
||||||
|
if (! is_dir($dir)) {
|
||||||
|
mkdir($dir, 0755, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
helper('filesystem');
|
||||||
|
|
||||||
|
// Build the class based on the details we have, We'll be getting our file
|
||||||
|
// contents from the template, and then we'll do the necessary replacements.
|
||||||
|
if (! write_file($path, $this->buildContent($class))) {
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
|
CLI::error(lang('CLI.generator.fileError', [clean_path($path)]), 'light_gray', 'red');
|
||||||
|
CLI::newLine();
|
||||||
|
|
||||||
|
return;
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->getOption('force') && $isFile) {
|
||||||
|
CLI::write(lang('CLI.generator.fileOverwrite', [clean_path($path)]), 'yellow');
|
||||||
|
CLI::newLine();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CLI::write(lang('CLI.generator.fileCreate', [clean_path($path)]), 'green');
|
||||||
|
CLI::newLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare options and do the necessary replacements.
|
||||||
|
*/
|
||||||
|
protected function prepare(string $class): string
|
||||||
|
{
|
||||||
|
return $this->parseTemplate($class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change file basename before saving.
|
||||||
|
*
|
||||||
|
* Useful for components where the file name has a date.
|
||||||
|
*/
|
||||||
|
protected function basename(string $filename): string
|
||||||
|
{
|
||||||
|
return basename($filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses the class name and checks if it is already qualified.
|
||||||
|
*/
|
||||||
|
protected function qualifyClassName(): string
|
||||||
|
{
|
||||||
|
// Gets the class name from input.
|
||||||
|
$class = $this->params[0] ?? CLI::getSegment(2);
|
||||||
|
|
||||||
|
if ($class === null && $this->hasClassName) {
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
|
$nameLang = $this->classNameLang ?: 'CLI.generator.className.default';
|
||||||
|
$class = CLI::prompt(lang($nameLang), null, 'required');
|
||||||
|
CLI::newLine();
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
|
}
|
||||||
|
|
||||||
|
helper('inflector');
|
||||||
|
|
||||||
|
$component = singular($this->component);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see https://regex101.com/r/a5KNCR/1
|
||||||
|
*/
|
||||||
|
$pattern = sprintf('/([a-z][a-z0-9_\/\\\\]+)(%s)/i', $component);
|
||||||
|
|
||||||
|
if (preg_match($pattern, $class, $matches) === 1) {
|
||||||
|
$class = $matches[1] . ucfirst($matches[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->enabledSuffixing && $this->getOption('suffix') && ! strripos($class, $component)) {
|
||||||
|
$class .= ucfirst($component);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trims input, normalize separators, and ensure that all paths are in Pascalcase.
|
||||||
|
$class = ltrim(implode('\\', array_map('pascalize', explode('\\', str_replace('/', '\\', trim($class))))), '\\/');
|
||||||
|
|
||||||
|
// Gets the namespace from input. Don't forget the ending backslash!
|
||||||
|
$namespace = trim(str_replace('/', '\\', $this->getOption('namespace') ?? APP_NAMESPACE), '\\') . '\\';
|
||||||
|
|
||||||
|
if (strncmp($class, $namespace, strlen($namespace)) === 0) {
|
||||||
|
return $class; // @codeCoverageIgnore
|
||||||
|
}
|
||||||
|
|
||||||
|
return $namespace . $this->directory . '\\' . str_replace('/', '\\', $class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the generator view as defined in the `Config\Generators::$views`,
|
||||||
|
* with fallback to `$template` when the defined view does not exist.
|
||||||
|
*/
|
||||||
|
protected function renderTemplate(array $data = []): string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return view(config('Generators')->views[$this->name], $data, ['debug' => false]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
log_message('error', $e->getMessage());
|
||||||
|
|
||||||
|
return view("CodeIgniter\\Commands\\Generators\\Views\\{$this->template}", $data, ['debug' => false]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs pseudo-variables contained within view file.
|
||||||
|
*/
|
||||||
|
protected function parseTemplate(string $class, array $search = [], array $replace = [], array $data = []): string
|
||||||
|
{
|
||||||
|
// Retrieves the namespace part from the fully qualified class name.
|
||||||
|
$namespace = trim(implode('\\', array_slice(explode('\\', $class), 0, -1)), '\\');
|
||||||
|
$search[] = '<@php';
|
||||||
|
$search[] = '{namespace}';
|
||||||
|
$search[] = '{class}';
|
||||||
|
$replace[] = '<?php';
|
||||||
|
$replace[] = $namespace;
|
||||||
|
$replace[] = str_replace($namespace . '\\', '', $class);
|
||||||
|
|
||||||
|
return str_replace($search, $replace, $this->renderTemplate($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the contents for class being generated, doing all
|
||||||
|
* the replacements necessary, and alphabetically sorts the
|
||||||
|
* imports for a given template.
|
||||||
|
*/
|
||||||
|
protected function buildContent(string $class): string
|
||||||
|
{
|
||||||
|
$template = $this->prepare($class);
|
||||||
|
|
||||||
|
if ($this->sortImports && preg_match('/(?P<imports>(?:^use [^;]+;$\n?)+)/m', $template, $match)) {
|
||||||
|
$imports = explode("\n", trim($match['imports']));
|
||||||
|
sort($imports);
|
||||||
|
|
||||||
|
return str_replace(trim($match['imports']), implode("\n", $imports), $template);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $template;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the file path from the class name.
|
||||||
|
*/
|
||||||
|
protected function buildPath(string $class): string
|
||||||
|
{
|
||||||
|
$namespace = trim(str_replace('/', '\\', $this->getOption('namespace') ?? APP_NAMESPACE), '\\');
|
||||||
|
|
||||||
|
// Check if the namespace is actually defined and we are not just typing gibberish.
|
||||||
|
$base = Services::autoloader()->getNamespace($namespace);
|
||||||
|
|
||||||
|
if (! $base = reset($base)) {
|
||||||
|
CLI::error(lang('CLI.namespaceNotDefined', [$namespace]), 'light_gray', 'red');
|
||||||
|
CLI::newLine();
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$base = realpath($base) ?: $base;
|
||||||
|
$file = $base . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, trim(str_replace($namespace . '\\', '', $class), '\\')) . '.php';
|
||||||
|
|
||||||
|
return implode(DIRECTORY_SEPARATOR, array_slice(explode(DIRECTORY_SEPARATOR, $file), 0, -1)) . DIRECTORY_SEPARATOR . $this->basename($file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows child generators to modify the internal `$hasClassName` flag.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
protected function setHasClassName(bool $hasClassName)
|
||||||
|
{
|
||||||
|
$this->hasClassName = $hasClassName;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows child generators to modify the internal `$sortImports` flag.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
protected function setSortImports(bool $sortImports)
|
||||||
|
{
|
||||||
|
$this->sortImports = $sortImports;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows child generators to modify the internal `$enabledSuffixing` flag.
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
protected function setEnabledSuffixing(bool $enabledSuffixing)
|
||||||
|
{
|
||||||
|
$this->enabledSuffixing = $enabledSuffixing;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a single command-line option. Returns TRUE if the option exists,
|
||||||
|
* but doesn't have a value, and is simply acting as a flag.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
protected function getOption(string $name)
|
||||||
|
{
|
||||||
|
if (! array_key_exists($name, $this->params)) {
|
||||||
|
return CLI::getOption($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->params[$name] ?? true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\Cache;
|
||||||
|
|
||||||
|
use CodeIgniter\Cache\Exceptions\CacheException;
|
||||||
|
use CodeIgniter\Exceptions\CriticalError;
|
||||||
|
use CodeIgniter\Test\Mock\MockCache;
|
||||||
|
use Config\Cache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A factory for loading the desired
|
||||||
|
*/
|
||||||
|
class CacheFactory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The class to use when mocking
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public static $mockClass = MockCache::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The service to inject the mock as
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public static $mockServiceName = 'cache';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to create the desired cache handler, based upon the
|
||||||
|
*
|
||||||
|
* @return CacheInterface
|
||||||
|
*/
|
||||||
|
public static function getHandler(Cache $config, ?string $handler = null, ?string $backup = null)
|
||||||
|
{
|
||||||
|
if (! isset($config->validHandlers) || ! is_array($config->validHandlers)) {
|
||||||
|
throw CacheException::forInvalidHandlers();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! isset($config->handler) || ! isset($config->backupHandler)) {
|
||||||
|
throw CacheException::forNoBackup();
|
||||||
|
}
|
||||||
|
|
||||||
|
$handler = ! empty($handler) ? $handler : $config->handler;
|
||||||
|
$backup = ! empty($backup) ? $backup : $config->backupHandler;
|
||||||
|
|
||||||
|
if (! array_key_exists($handler, $config->validHandlers) || ! array_key_exists($backup, $config->validHandlers)) {
|
||||||
|
throw CacheException::forHandlerNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
$adapter = new $config->validHandlers[$handler]($config);
|
||||||
|
|
||||||
|
if (! $adapter->isSupported()) {
|
||||||
|
$adapter = new $config->validHandlers[$backup]($config);
|
||||||
|
|
||||||
|
if (! $adapter->isSupported()) {
|
||||||
|
// Fall back to the dummy adapter.
|
||||||
|
$adapter = new $config->validHandlers['dummy']();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If $adapter->initialization throws a CriticalError exception, we will attempt to
|
||||||
|
// use the $backup handler, if that also fails, we resort to the dummy handler.
|
||||||
|
try {
|
||||||
|
$adapter->initialize();
|
||||||
|
} catch (CriticalError $e) {
|
||||||
|
log_message('critical', $e->getMessage() . ' Resorting to using ' . $backup . ' handler.');
|
||||||
|
|
||||||
|
// get the next best cache handler (or dummy if the $backup also fails)
|
||||||
|
$adapter = self::getHandler($config, $backup, 'dummy');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $adapter;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\Cache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache interface
|
||||||
|
*/
|
||||||
|
interface CacheInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Takes care of any handler-specific setup that must be done.
|
||||||
|
*/
|
||||||
|
public function initialize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to fetch an item from the cache store.
|
||||||
|
*
|
||||||
|
* @param string $key Cache item name
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get(string $key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves an item to the cache store.
|
||||||
|
*
|
||||||
|
* @param string $key Cache item name
|
||||||
|
* @param mixed $value The data to save
|
||||||
|
* @param int $ttl Time To Live, in seconds (default 60)
|
||||||
|
*
|
||||||
|
* @return bool Success or failure
|
||||||
|
*/
|
||||||
|
public function save(string $key, $value, int $ttl = 60);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a specific item from the cache store.
|
||||||
|
*
|
||||||
|
* @param string $key Cache item name
|
||||||
|
*
|
||||||
|
* @return bool Success or failure
|
||||||
|
*/
|
||||||
|
public function delete(string $key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs atomic incrementation of a raw stored value.
|
||||||
|
*
|
||||||
|
* @param string $key Cache ID
|
||||||
|
* @param int $offset Step/value to increase by
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function increment(string $key, int $offset = 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs atomic decrementation of a raw stored value.
|
||||||
|
*
|
||||||
|
* @param string $key Cache ID
|
||||||
|
* @param int $offset Step/value to increase by
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function decrement(string $key, int $offset = 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will delete all items in the entire cache.
|
||||||
|
*
|
||||||
|
* @return bool Success or failure
|
||||||
|
*/
|
||||||
|
public function clean();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns information on the entire cache.
|
||||||
|
*
|
||||||
|
* The information returned and the structure of the data
|
||||||
|
* varies depending on the handler.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getCacheInfo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns detailed information about the specific item in the cache.
|
||||||
|
*
|
||||||
|
* @param string $key Cache item name.
|
||||||
|
*
|
||||||
|
* @return array|false|null
|
||||||
|
* Returns null if the item does not exist, otherwise array<string, mixed>
|
||||||
|
* with at least the 'expire' key for absolute epoch expiry (or null).
|
||||||
|
* Some handlers may return false when an item does not exist, which is deprecated.
|
||||||
|
*/
|
||||||
|
public function getMetaData(string $key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if the driver is supported on this system.
|
||||||
|
*/
|
||||||
|
public function isSupported(): bool;
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\Cache\Exceptions;
|
||||||
|
|
||||||
|
use CodeIgniter\Exceptions\DebugTraceableTrait;
|
||||||
|
use CodeIgniter\Exceptions\ExceptionInterface;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CacheException
|
||||||
|
*/
|
||||||
|
class CacheException extends RuntimeException implements ExceptionInterface
|
||||||
|
{
|
||||||
|
use DebugTraceableTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown when handler has no permission to write cache.
|
||||||
|
*
|
||||||
|
* @return CacheException
|
||||||
|
*/
|
||||||
|
public static function forUnableToWrite(string $path)
|
||||||
|
{
|
||||||
|
return new static(lang('Cache.unableToWrite', [$path]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown when an unrecognized handler is used.
|
||||||
|
*
|
||||||
|
* @return CacheException
|
||||||
|
*/
|
||||||
|
public static function forInvalidHandlers()
|
||||||
|
{
|
||||||
|
return new static(lang('Cache.invalidHandlers'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown when no backup handler is setup in config.
|
||||||
|
*
|
||||||
|
* @return CacheException
|
||||||
|
*/
|
||||||
|
public static function forNoBackup()
|
||||||
|
{
|
||||||
|
return new static(lang('Cache.noBackup'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown when specified handler was not found.
|
||||||
|
*
|
||||||
|
* @return CacheException
|
||||||
|
*/
|
||||||
|
public static function forHandlerNotFound()
|
||||||
|
{
|
||||||
|
return new static(lang('Cache.handlerNotFound'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\Cache\Exceptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a domain-level interface for broad capture
|
||||||
|
* of all framework-related exceptions.
|
||||||
|
*
|
||||||
|
* catch (\CodeIgniter\Cache\Exceptions\ExceptionInterface) { ... }
|
||||||
|
*
|
||||||
|
* @deprecated 4.1.2
|
||||||
|
*/
|
||||||
|
interface ExceptionInterface
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\Cache\Handlers;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use CodeIgniter\Cache\CacheInterface;
|
||||||
|
use Exception;
|
||||||
|
use InvalidArgumentException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for cache handling
|
||||||
|
*/
|
||||||
|
abstract class BaseHandler implements CacheInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Reserved characters that cannot be used in a key or tag. May be overridden by the config.
|
||||||
|
* From https://github.com/symfony/cache-contracts/blob/c0446463729b89dd4fa62e9aeecc80287323615d/ItemInterface.php#L43
|
||||||
|
*
|
||||||
|
* @deprecated in favor of the Cache config
|
||||||
|
*/
|
||||||
|
public const RESERVED_CHARACTERS = '{}()/\@:';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum key length.
|
||||||
|
*/
|
||||||
|
public const MAX_KEY_LENGTH = PHP_INT_MAX;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefix to apply to cache keys.
|
||||||
|
* May not be used by all handlers.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $prefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a cache key according to PSR-6.
|
||||||
|
* Keys that exceed MAX_KEY_LENGTH are hashed.
|
||||||
|
* From https://github.com/symfony/cache/blob/7b024c6726af21fd4984ac8d1eae2b9f3d90de88/CacheItem.php#L158
|
||||||
|
*
|
||||||
|
* @param string $key The key to validate
|
||||||
|
* @param string $prefix Optional prefix to include in length calculations
|
||||||
|
*
|
||||||
|
* @throws InvalidArgumentException When $key is not valid
|
||||||
|
*/
|
||||||
|
public static function validateKey($key, $prefix = ''): string
|
||||||
|
{
|
||||||
|
if (! is_string($key)) {
|
||||||
|
throw new InvalidArgumentException('Cache key must be a string');
|
||||||
|
}
|
||||||
|
if ($key === '') {
|
||||||
|
throw new InvalidArgumentException('Cache key cannot be empty.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$reserved = config('Cache')->reservedCharacters ?? self::RESERVED_CHARACTERS;
|
||||||
|
if ($reserved && strpbrk($key, $reserved) !== false) {
|
||||||
|
throw new InvalidArgumentException('Cache key contains reserved characters ' . $reserved);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the key with prefix exceeds the length then return the hashed version
|
||||||
|
return strlen($prefix . $key) > static::MAX_KEY_LENGTH ? $prefix . md5($key) : $prefix . $key;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an item from the cache, or execute the given Closure and store the result.
|
||||||
|
*
|
||||||
|
* @param string $key Cache item name
|
||||||
|
* @param int $ttl Time to live
|
||||||
|
* @param Closure $callback Callback return value
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function remember(string $key, int $ttl, Closure $callback)
|
||||||
|
{
|
||||||
|
$value = $this->get($key);
|
||||||
|
|
||||||
|
if ($value !== null) {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->save($key, $value = $callback(), $ttl);
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes items from the cache store matching a given pattern.
|
||||||
|
*
|
||||||
|
* @param string $pattern Cache items glob-style pattern
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function deleteMatching(string $pattern)
|
||||||
|
{
|
||||||
|
throw new Exception('The deleteMatching method is not implemented.');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\Cache\Handlers;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dummy cache handler
|
||||||
|
*/
|
||||||
|
class DummyHandler extends BaseHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function get(string $key)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function remember(string $key, int $ttl, Closure $callback)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function save(string $key, $value, int $ttl = 60)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function delete(string $key)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function deleteMatching(string $pattern)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function increment(string $key, int $offset = 1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function decrement(string $key, int $offset = 1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function clean()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function getCacheInfo()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function getMetaData(string $key)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function isSupported(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,423 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is part of CodeIgniter 4 framework.
|
||||||
|
*
|
||||||
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CodeIgniter\Cache\Handlers;
|
||||||
|
|
||||||
|
use CodeIgniter\Cache\Exceptions\CacheException;
|
||||||
|
use Config\Cache;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File system cache handler
|
||||||
|
*/
|
||||||
|
class FileHandler extends BaseHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Maximum key length.
|
||||||
|
*/
|
||||||
|
public const MAX_KEY_LENGTH = 255;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Where to store cached files on the disk.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mode for the stored files.
|
||||||
|
* Must be chmod-safe (octal).
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*
|
||||||
|
* @see https://www.php.net/manual/en/function.chmod.php
|
||||||
|
*/
|
||||||
|
protected $mode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws CacheException
|
||||||
|
*/
|
||||||
|
public function __construct(Cache $config)
|
||||||
|
{
|
||||||
|
if (! property_exists($config, 'file')) {
|
||||||
|
$config->file = [
|
||||||
|
'storePath' => $config->storePath ?? WRITEPATH . 'cache',
|
||||||
|
'mode' => 0640,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->path = ! empty($config->file['storePath']) ? $config->file['storePath'] : WRITEPATH . 'cache';
|
||||||
|
$this->path = rtrim($this->path, '/') . '/';
|
||||||
|
|
||||||
|
if (! is_really_writable($this->path)) {
|
||||||
|
throw CacheException::forUnableToWrite($this->path);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mode = $config->file['mode'] ?? 0640;
|
||||||
|
$this->prefix = $config->prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function get(string $key)
|
||||||
|
{
|
||||||
|
$key = static::validateKey($key, $this->prefix);
|
||||||
|
$data = $this->getItem($key);
|
||||||
|
|
||||||
|
return is_array($data) ? $data['data'] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function save(string $key, $value, int $ttl = 60)
|
||||||
|
{
|
||||||
|
$key = static::validateKey($key, $this->prefix);
|
||||||
|
|
||||||
|
$contents = [
|
||||||
|
'time' => time(),
|
||||||
|
'ttl' => $ttl,
|
||||||
|
'data' => $value,
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($this->writeFile($this->path . $key, serialize($contents))) {
|
||||||
|
try {
|
||||||
|
chmod($this->path . $key, $this->mode);
|
||||||
|
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
log_message('debug', 'Failed to set mode on cache file: ' . $e->getMessage());
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function delete(string $key)
|
||||||
|
{
|
||||||
|
$key = static::validateKey($key, $this->prefix);
|
||||||
|
|
||||||
|
return is_file($this->path . $key) && unlink($this->path . $key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function deleteMatching(string $pattern)
|
||||||
|
{
|
||||||
|
$deleted = 0;
|
||||||
|
|
||||||
|
foreach (glob($this->path . $pattern, GLOB_NOSORT) as $filename) {
|
||||||
|
if (is_file($filename) && @unlink($filename)) {
|
||||||
|
$deleted++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $deleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function increment(string $key, int $offset = 1)
|
||||||
|
{
|
||||||
|
$key = static::validateKey($key, $this->prefix);
|
||||||
|
$data = $this->getItem($key);
|
||||||
|
|
||||||
|
if ($data === false) {
|
||||||
|
$data = [
|
||||||
|
'data' => 0,
|
||||||
|
'ttl' => 60,
|
||||||
|
];
|
||||||
|
} elseif (! is_int($data['data'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$newValue = $data['data'] + $offset;
|
||||||
|
|
||||||
|
return $this->save($key, $newValue, $data['ttl']) ? $newValue : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function decrement(string $key, int $offset = 1)
|
||||||
|
{
|
||||||
|
$key = static::validateKey($key, $this->prefix);
|
||||||
|
$data = $this->getItem($key);
|
||||||
|
|
||||||
|
if ($data === false) {
|
||||||
|
$data = [
|
||||||
|
'data' => 0,
|
||||||
|
'ttl' => 60,
|
||||||
|
];
|
||||||
|
} elseif (! is_int($data['data'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$newValue = $data['data'] - $offset;
|
||||||
|
|
||||||
|
return $this->save($key, $newValue, $data['ttl']) ? $newValue : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function clean()
|
||||||
|
{
|
||||||
|
return $this->deleteFiles($this->path, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function getCacheInfo()
|
||||||
|
{
|
||||||
|
return $this->getDirFileInfo($this->path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function getMetaData(string $key)
|
||||||
|
{
|
||||||
|
$key = static::validateKey($key, $this->prefix);
|
||||||
|
|
||||||
|
if (false === $data = $this->getItem($key)) {
|
||||||
|
return false; // @TODO This will return null in a future release
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'expire' => $data['ttl'] > 0 ? $data['time'] + $data['ttl'] : null,
|
||||||
|
'mtime' => filemtime($this->path . $key),
|
||||||
|
'data' => $data['data'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function isSupported(): bool
|
||||||
|
{
|
||||||
|
return is_writable($this->path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does the heavy lifting of actually retrieving the file and
|
||||||
|
* verifying it's age.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
protected function getItem(string $filename)
|
||||||
|
{
|
||||||
|
if (! is_file($this->path . $filename)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = @unserialize(file_get_contents($this->path . $filename));
|
||||||
|
if (! is_array($data) || ! isset($data['ttl'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($data['ttl'] > 0 && time() > $data['time'] + $data['ttl']) {
|
||||||
|
// If the file is still there then try to remove it
|
||||||
|
if (is_file($this->path . $filename)) {
|
||||||
|
@unlink($this->path . $filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a file to disk, or returns false if not successful.
|
||||||
|
*
|
||||||
|
* @param string $path
|
||||||
|
* @param string $data
|
||||||
|
* @param string $mode
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function writeFile($path, $data, $mode = 'wb')
|
||||||
|
{
|
||||||
|
if (($fp = @fopen($path, $mode)) === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
flock($fp, LOCK_EX);
|
||||||
|
|
||||||
|
for ($result = $written = 0, $length = strlen($data); $written < $length; $written += $result) {
|
||||||
|
if (($result = fwrite($fp, substr($data, $written))) === false) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
flock($fp, LOCK_UN);
|
||||||
|
fclose($fp);
|
||||||
|
|
||||||
|
return is_int($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes all files contained in the supplied directory path.
|
||||||
|
* Files must be writable or owned by the system in order to be deleted.
|
||||||
|
* If the second parameter is set to TRUE, any directories contained
|
||||||
|
* within the supplied base directory will be nuked as well.
|
||||||
|
*
|
||||||
|
* @param string $path File path
|
||||||
|
* @param bool $delDir Whether to delete any directories found in the path
|
||||||
|
* @param bool $htdocs Whether to skip deleting .htaccess and index page files
|
||||||
|
* @param int $_level Current directory depth level (default: 0; internal use only)
|
||||||
|
*/
|
||||||
|
protected function deleteFiles(string $path, bool $delDir = false, bool $htdocs = false, int $_level = 0): bool
|
||||||
|
{
|
||||||
|
// Trim the trailing slash
|
||||||
|
$path = rtrim($path, '/\\');
|
||||||
|
|
||||||
|
if (! $currentDir = @opendir($path)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (false !== ($filename = @readdir($currentDir))) {
|
||||||
|
if ($filename !== '.' && $filename !== '..') {
|
||||||
|
if (is_dir($path . DIRECTORY_SEPARATOR . $filename) && $filename[0] !== '.') {
|
||||||
|
$this->deleteFiles($path . DIRECTORY_SEPARATOR . $filename, $delDir, $htdocs, $_level + 1);
|
||||||
|
} elseif ($htdocs !== true || ! preg_match('/^(\.htaccess|index\.(html|htm|php)|web\.config)$/i', $filename)) {
|
||||||
|
@unlink($path . DIRECTORY_SEPARATOR . $filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closedir($currentDir);
|
||||||
|
|
||||||
|
return ($delDir === true && $_level > 0) ? @rmdir($path) : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads the specified directory and builds an array containing the filenames,
|
||||||
|
* filesize, dates, and permissions
|
||||||
|
*
|
||||||
|
* Any sub-folders contained within the specified path are read as well.
|
||||||
|
*
|
||||||
|
* @param string $sourceDir Path to source
|
||||||
|
* @param bool $topLevelOnly Look only at the top level directory specified?
|
||||||
|
* @param bool $_recursion Internal variable to determine recursion status - do not use in calls
|
||||||
|
*
|
||||||
|
* @return array|false
|
||||||
|
*/
|
||||||
|
protected function getDirFileInfo(string $sourceDir, bool $topLevelOnly = true, bool $_recursion = false)
|
||||||
|
{
|
||||||
|
static $_filedata = [];
|
||||||
|
$relativePath = $sourceDir;
|
||||||
|
|
||||||
|
if ($fp = @opendir($sourceDir)) {
|
||||||
|
// reset the array and make sure $source_dir has a trailing slash on the initial call
|
||||||
|
if ($_recursion === false) {
|
||||||
|
$_filedata = [];
|
||||||
|
$sourceDir = rtrim(realpath($sourceDir) ?: $sourceDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used to be foreach (scandir($source_dir, 1) as $file), but scandir() is simply not as fast
|
||||||
|
while (false !== ($file = readdir($fp))) {
|
||||||
|
if (is_dir($sourceDir . $file) && $file[0] !== '.' && $topLevelOnly === false) {
|
||||||
|
$this->getDirFileInfo($sourceDir . $file . DIRECTORY_SEPARATOR, $topLevelOnly, true);
|
||||||
|
} elseif ($file[0] !== '.') {
|
||||||
|
$_filedata[$file] = $this->getFileInfo($sourceDir . $file);
|
||||||
|
$_filedata[$file]['relative_path'] = $relativePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closedir($fp);
|
||||||
|
|
||||||
|
return $_filedata;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a file and path, returns the name, path, size, date modified
|
||||||
|
* Second parameter allows you to explicitly declare what information you want returned
|
||||||
|
* Options are: name, server_path, size, date, readable, writable, executable, fileperms
|
||||||
|
* Returns FALSE if the file cannot be found.
|
||||||
|
*
|
||||||
|
* @param string $file Path to file
|
||||||
|
* @param mixed $returnedValues Array or comma separated string of information returned
|
||||||
|
*
|
||||||
|
* @return array|false
|
||||||
|
*/
|
||||||
|
protected function getFileInfo(string $file, $returnedValues = ['name', 'server_path', 'size', 'date'])
|
||||||
|
{
|
||||||
|
if (! is_file($file)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_string($returnedValues)) {
|
||||||
|
$returnedValues = explode(',', $returnedValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
$fileInfo = [];
|
||||||
|
|
||||||
|
foreach ($returnedValues as $key) {
|
||||||
|
switch ($key) {
|
||||||
|
case 'name':
|
||||||
|
$fileInfo['name'] = basename($file);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'server_path':
|
||||||
|
$fileInfo['server_path'] = $file;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'size':
|
||||||
|
$fileInfo['size'] = filesize($file);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'date':
|
||||||
|
$fileInfo['date'] = filemtime($file);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'readable':
|
||||||
|
$fileInfo['readable'] = is_readable($file);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'writable':
|
||||||
|
$fileInfo['writable'] = is_writable($file);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'executable':
|
||||||
|
$fileInfo['executable'] = is_executable($file);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'fileperms':
|
||||||
|
$fileInfo['fileperms'] = fileperms($file);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $fileInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user