Commit realizando cambios en los roles de los usuarios

This commit is contained in:
Jaime Jimenez
2023-04-24 13:00:46 +02:00
parent 2d67588770
commit 8c4d77a598
6587 changed files with 365497 additions and 0 deletions

133
acciones.txt Normal file
View File

@ -0,0 +1,133 @@
Quitar Oauth
---------------------------------------------
Quitar packete con composer que se usa en la Oauth
composer remove hybridauth/hybridauth
Tablas en la BBDD.
wg_user_oauth
wg_settings_oauth
Se hace migración (hay que añadir el controlador Migrate a whiteListController)
Modelos
UserOauthModel.php
SettingsOauthModel.php
Controllers
Oauth.php
Realizar busqueda de UserOauthModel que está en varios Controllers
Buscar la variable que crea en cada controlador y ver para que la usa
Igual que la acción anterior pero con SettingsOauthModel
Está en el controlador Settings.php. Buscar la variable que crea y borrarla
Eliminar Views\themes\backend\focus2\form\settings\oauth.php
En Views\themes\backend\focus2\main\menu.
Quitar la línea php que invoca a la configuración de Oauth (site_url("settings/oauth"))
En Views\themes\frontend\tivo\main\menu.php
Quitar la línea php que invoca a la configuración de Oauth (site_url("settings/oauth"))
En en controlador Settings.php
Quitar las funciones oauth() y oauth_store()
En los idiomas quitar la key dashboard_chart_auth
En la vista quitar la carta de Solcial autenthification
<div class="col-lg-4">
<div class="card">
<div class="card-header">
<h4 class="card-title"><?=lang("App.dashboard_chart_auth")?></h4>
</div>
<div class="card-body">
<div class="row">
<div class="col-lg-12" id="ct-icon-chart"></div>
</div>
<div class="row">
<div class="col-lg-12"><div class="ct-pie-chart"></div></div>
</div>
</div>
</div>
</div>
Quitar los SMS
--------------------------------------------
Quitar packete con composer que se usa en la Oauth
twilio/sdk
Dentro de Controllers\Integration.php
Eliminar sendSMS (public y private)
Se hace migración de la BBDD
Del controlador Cron.php se elimina
la accion // Cron Notification SMS
la función test()
Del controlador Ajax.php
linea 368, quitar is_send_sms de la lista
linea 399, eliminar "is_send_sms"=>$record['is_send_sms'],
Del controlador Login.php eliminar
//Notification SMS User Welcome
//SMS Account Confirmation
Dentro de //Notification New Register, las dos líneas is_send_sms y send_sms_notification
linea 455 if($settings['send_sms_register']??false){ quitar if completo
Del controlador Notification.php
linea 117 , 148, 150
Del controlador Settings.php
linea 106, 109
De los idiomas, quitar los registros
settings_field_send_sms_register
notification_field_send_sms
Del modelo NotificationModel.php
Quitar los fields is_send_sms y send_sms_notification
Del modelo SettingsModel.php
Quitar los fields send_sms_register y send_sms_welcome
sms_gateway, sms_account_id, ,sms_auth_token, sms_info_add, sms_confirmation
De la vista Views\themes\backend\focus2\form\notification\form quitar
<div class="col-md-3">
<div class="form-group">
<label class="text-dark"><?=lang("App.notification_field_send_sms")?></label>
<div class="custom-control custom-switch">
<input type="checkbox" id="send_sms_notification" name="send_sms_notification" class="custom-control-input" <?= $obj['send_sms_notification']??false ? 'checked' : ''?>>
<label for="send_sms_notification" class="custom-control-label"><?=lang("App.notification_field_send_label")?></label>
</div>
</div>
</div>
De la vista Views\themes\backend\focus2\form\notification\index.php quitar de la linea 129 { data: 'is_send_sms' },
De la vista Views\themes\backend\focus2\form\settings\index.php quitar los siguientes bloques
<div class="col-lg-3">
<div class="form-group">
<label class="text-dark"><?=lang("App.settings_field_send_welcome_message_sms")?></label>
<div class="custom-control custom-switch">
<input type="checkbox" id="send_sms_welcome" name="send_sms_welcome" class="custom-control-input" <?= $obj['send_sms_welcome']??false ? 'checked' : ''?>>
<label for="send_sms_welcome" class="custom-control-label"><?=lang("App.global_activate")?></label>
</div>
</div>
</div>
y
<div class="col-lg-3">
<div class="form-group">
<label class="text-dark"><?=lang("App.settings_field_send_sms_register")?></label>
<div class="custom-control custom-switch">
<input type="checkbox" id="send_sms_register" name="send_sms_register" class="custom-control-input" <?= $obj['send_sms_register']??false ? 'checked' : ''?>>
<label for="send_sms_register" class="custom-control-label"><?=lang("App.global_activate")?></label>
</div>
</div>
</div>
En el controlador Ajax.php quitar if($records[$key]['sms_confirmed'] == 1)
En el controlador Login.php quitar
bloque // Check sms confirmed
if($confirmation['type'] == 'sms')
En el controlador Settings.php quitar
linea 104
case 'sms;
En el controlador User.php quitar linea 217 y 236
Del modelo UserModel.php quitar el campo sms_confirmed
En los idiomas buscar la key sms
En la vista Views\themes\backend\focus2\form\notification\index.php quitar linea 49
En la vista Views\themes\backend\focus2\form\settings\index.php quitar
linea 37
bloque en linea 298
linea 355
bloque en linea 679
linea 1033
En la vista Views\themes\backend\focus2\form\settings\template.php
bloque linea 87 hasta 131
En la vista Views\themes\backend\focus2\form\user\form.php
bloque linea 104 hasta 113
linea 210
Renombrar tablas a auth_ en lugar de wg_
-------------------------------------------------
La tabla wg_migrations hay que modificarla a mano.
En .env quitar el prefijo: database.default.DBPrefix =
En todos los modelos añadir auth_ al principio del nombre de la tabla

127
ci4/.gitignore vendored Normal file
View File

@ -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
#-------------------------
# 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

7
ci4/.htaccess Normal file
View File

@ -0,0 +1,7 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond $1 !^(index\.php|images|assets|doc|data|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

6
ci4/app/.htaccess Normal file
View File

@ -0,0 +1,6 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>

15
ci4/app/Common.php Normal file
View File

@ -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/
*/

465
ci4/app/Config/App.php Normal file
View File

@ -0,0 +1,465 @@
<?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 = '';
/**
* --------------------------------------------------------------------------
* 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 = '';
/**
* --------------------------------------------------------------------------
* 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 = true;
/**
* --------------------------------------------------------------------------
* 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','es','pt'];
/**
* --------------------------------------------------------------------------
* 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/Sao_Paulo';
/**
* --------------------------------------------------------------------------
* 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;
}

View File

@ -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 = [];
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

167
ci4/app/Config/Cache.php Normal file
View File

@ -0,0 +1,167 @@
<?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;
/**
* --------------------------------------------------------------------------
* 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,
];
}

View File

@ -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

View File

@ -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;
}

119
ci4/app/Config/Cookie.php Normal file
View File

@ -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;
}

View File

@ -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';
}
}
}

View File

@ -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">',
];
}

170
ci4/app/Config/Email.php Normal file
View File

@ -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;
}

View File

@ -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';
}

50
ci4/app/Config/Events.php Normal file
View File

@ -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();
}
});

View File

@ -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 = [];
}

107
ci4/app/Config/Filters.php Normal file
View File

@ -0,0 +1,107 @@
<?php
namespace Config;
use App\Filters\JWTAuthFilter;
use App\Filters\LoginAuthFilter;
use App\Filters\ThrottlerFilter;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Filters\CSRF;
use CodeIgniter\Filters\DebugToolbar;
use CodeIgniter\Filters\Honeypot;
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,
'auth' => JWTAuthFilter::class,
'throttler' => ThrottlerFilter::class,
'login' => LoginAuthFilter::class,
];
/**
* List of filter aliases that are always
* applied before and after every request.
*
* @var array
*/
public $globals = [
'before' => [
'login' => [
'except' => [
'login',
'login/*',
'oauth',
'oauth/*',
'api',
'api/*',
'cron',
'cron/*',
'lang',
'lang/*',
'language',
'language/*',
'integration',
'integration/*'
]
],
// 'honeypot',
'csrf' => [
'except' => [
'api',
'api/*'
]
],
],
'after' => [
'toolbar',
// 'honeypot',
],
];
/**
* List of filter aliases that works on a
* particular HTTP method (GET, POST, etc.).
*
* Example:
* 'post' => ['csrf', 'throttle']
*
* @var array
*/
public $methods = [
// 'get' => ['throttler'],
// 'post' => ['throttler']
];
/**
* List of filter aliases that should run on any
* before or after URI patterns.
*
* Example:
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
*
* @var array
*/
public $filters = [
'auth' => [
'before' => [
'api/user/*',
'api/user/'
],
],
'throttler' => [
'before' => [
'api/*',
'api/'
]
]
];
}

View File

@ -0,0 +1,9 @@
<?php
namespace Config;
use CodeIgniter\Config\ForeignCharacters as BaseForeignCharacters;
class ForeignCharacters extends BaseForeignCharacters
{
}

75
ci4/app/Config/Format.php Normal file
View File

@ -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);
}
}

View File

@ -0,0 +1,39 @@
<?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:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php',
'make:entity' => 'CodeIgniter\Commands\Generators\Views\entity.tpl.php',
'make:filter' => 'CodeIgniter\Commands\Generators\Views\filter.tpl.php',
'make:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
'make:model' => 'CodeIgniter\Commands\Generators\Views\model.tpl.php',
'make:seeder' => 'CodeIgniter\Commands\Generators\Views\seeder.tpl.php',
'make:validation' => 'CodeIgniter\Commands\Generators\Views\validation.tpl.php',
'session:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
];
}

View File

@ -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>';
}

35
ci4/app/Config/Images.php Normal file
View File

@ -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,
];
}

61
ci4/app/Config/Kint.php Normal file
View File

@ -0,0 +1,61 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use Kint\Renderer\AbstractRenderer;
/**
* --------------------------------------------------------------------------
* 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 = AbstractRenderer::SORT_FULL;
public $richObjectPlugins;
public $richTabPlugins;
/*
|--------------------------------------------------------------------------
| CLI Settings
|--------------------------------------------------------------------------
*/
public $cliColors = true;
public $cliForceUTF8 = false;
public $cliDetectWidth = true;
public $cliMinWidth = 40;
}

153
ci4/app/Config/Logger.php Normal file
View File

@ -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,
// ],
];
}

View File

@ -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_';
}

534
ci4/app/Config/Mimes.php Normal file
View File

@ -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;
}
}

View File

@ -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',
];
}

39
ci4/app/Config/Pager.php Normal file
View File

@ -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;
}

85
ci4/app/Config/Paths.php Normal file
View File

@ -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__ . '/../../vendor/codeigniter4/framework/system';
/**
* ---------------------------------------------------------------
* APPLICATION FOLDER NAME
* ---------------------------------------------------------------
*
* If you want this front controller to use a different "app"
* folder than the default one you can set its name here. The folder
* can also be renamed or relocated anywhere on your getServer. If
* you do, use a full getServer path.
*
* @see http://codeigniter.com/user_guide/general/managing_apps.html
*
* @var string
*/
public $appDirectory = __DIR__ . '/..';
/**
* ---------------------------------------------------------------
* 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';
}

70
ci4/app/Config/Routes.php Normal file
View File

@ -0,0 +1,70 @@
<?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.
//WEB ROUTER ------------------------------------------------------
//------------------------------------------------------------------
$routes->get('/', 'Home::index');
$routes->get('lang/{locale}', 'Language::index');
//API ROUTER ------------------------------------------------------
//------------------------------------------------------------------
$routes->get('api/','Api::index');
$routes->get('api/status','Api::status');
$routes->post('api/signIn','Api::signIn');
//API ROUTER USER ------------------------------------------------------
//------------------------------------------------------------------
$routes->get('api/user/','Api::user/all');
$routes->get('api/user/(:segment)','Api::user/id/$1');
$routes->post('api/user/','Api::user/add');
$routes->put('api/user/(:segment)','Api::user/edit/$1');
$routes->delete('api/user/(:segment)','Api::user/delete/$1');
/*
* --------------------------------------------------------------------
* 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';
}

View File

@ -0,0 +1,95 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Security extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CSRF Token Name
* --------------------------------------------------------------------------
*
* Token name for Cross Site Request Forgery protection cookie.
*
* @var string
*/
public $tokenName = 'csrf_test_name';
/**
* --------------------------------------------------------------------------
* CSRF Header Name
* --------------------------------------------------------------------------
*
* Token name for Cross Site Request Forgery protection cookie.
*
* @var string
*/
public $headerName = 'X-CSRF-TOKEN';
/**
* --------------------------------------------------------------------------
* CSRF Cookie Name
* --------------------------------------------------------------------------
*
* Cookie name for Cross Site Request Forgery protection cookie.
*
* @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 request.
*
* @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';
}

View File

@ -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();
* }
*/
}

View File

@ -0,0 +1,87 @@
<?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,
];
/**
* --------------------------------------------------------------------------
* 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;
}

View File

@ -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',
];
}

View File

@ -0,0 +1,44 @@
<?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,
\App\Validation\ApiAuthRules::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
//--------------------------------------------------------------------
}

44
ci4/app/Config/View.php Normal file
View File

@ -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 = [];
}

View File

@ -0,0 +1,86 @@
<?php
namespace App\Controllers;
use App\Models\ActivityModel;
use App\Models\UserModel;
class Activity extends BaseController
{
private $user_model;
private $activity_model;
function __construct()
{
$this->user_model = new UserModel();
$this->activity_model = new ActivityModel();
}
public function index()
{
$session = session();
$data['title'] = [
'module' => lang("App.activity_title"),
'page' => lang("App.activity_subtitle"),
'icon' => 'fas fa-list'
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.activity_title"), 'route' => "", 'active' => true]
];
$data['logs'] = $this->activity_model->select('SUM( IF( os LIKE "%Windows%", 1, 0 ) ) AS windows,
SUM( IF( os = "Mac OS X", 1, 0 ) ) AS mac,
SUM( IF( os = "Linux", 1, 0 ) ) AS linux,
SUM( IF( os = "Android", 1, 0 ) ) AS android,
SUM( IF( os = "iOS", 1, 0 ) ) AS iphone,
SUM( IF( browser LIKE "%Chrome%", 1, 0 ) ) AS chrome,
SUM( IF( browser LIKE "%Firefox%", 1, 0 ) ) AS firefox,
SUM( IF( browser LIKE "%Safari%", 1, 0 ) ) AS safari,
SUM( IF( browser LIKE "%Internet Explorer%", 1, 0 ) ) AS ie,
SUM( IF( browser LIKE "%Edge%", 1, 0 ) ) AS edge,
SUM( IF( browser LIKE "%Opera%", 1, 0 ) ) AS opera')->where('activity.user',$session->get('token'))->first();
$data['all'] = "";
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/activity/index',$data);
echo view(getenv('theme.path').'main/footer');
}
public function all()
{
$session = session();
$dashboard = $session->get('dashboard')??'user';
if($dashboard != 'admin'){
return redirect()->to('/activity');
}
$data['title'] = [
'module' => lang("App.activity_title"),
'page' => lang("App.activity_subtitle"),
'icon' => 'fas fa-list'
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.activity_title"), 'route' => "", 'active' => true]
];
$data['logs'] = $this->activity_model->select('SUM( IF( os LIKE "%Windows%", 1, 0 ) ) AS windows,
SUM( IF( os = "Mac OS X", 1, 0 ) ) AS mac,
SUM( IF( os = "Linux", 1, 0 ) ) AS linux,
SUM( IF( os = "Android", 1, 0 ) ) AS android,
SUM( IF( os = "iOS", 1, 0 ) ) AS iphone,
SUM( IF( browser LIKE "%Chrome%", 1, 0 ) ) AS chrome,
SUM( IF( browser LIKE "%Firefox%", 1, 0 ) ) AS firefox,
SUM( IF( browser LIKE "%Safari%", 1, 0 ) ) AS safari,
SUM( IF( browser LIKE "%Internet Explorer%", 1, 0 ) ) AS ie,
SUM( IF( browser LIKE "%Edge%", 1, 0 ) ) AS edge,
SUM( IF( browser LIKE "%Opera%", 1, 0 ) ) AS opera')->first();
$data['all'] = "/all";
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/activity/index',$data);
echo view(getenv('theme.path').'main/footer');
}
}

View File

@ -0,0 +1,488 @@
<?php
namespace App\Controllers;
use App\Models\CronTabModel;
use App\Models\NotificationModel;
use App\Models\UserModel;
use App\Models\UserGroupModel;
use App\Models\GroupUserModel;
use App\Models\ActivityModel;
use CodeIgniter\RESTful\ResourceController;
class Ajax extends ResourceController
{
private $user_model;
private $group_model;
private $group_user_model;
private $activity_model;
private $crontab_model;
private $notification_model;
private $id_user;
private $token_user;
function __construct()
{
$this->user_model = new UserModel();
$this->group_model = new UserGroupModel();
$this->group_user_model = new GroupUserModel();
$this->activity_model = new ActivityModel();
$this->crontab_model = new CronTabModel();
$this->notification_model = new NotificationModel();
$this->id_user = session()->get('id_user');
$this->token_user = session()->get('token');
$language = \Config\Services::language();
$language->setLocale(session()->lang);
}
public function index()
{
return redirect()->to('/home');
}
public function getUsers(){
$postData = service('request')->getVar();
if($postData != null && isset($postData->data)){
$dtpostData = $postData->data;
//Read value
$draw = $dtpostData->draw;
$start = $dtpostData->start;
$rowperpage = $dtpostData->length; // Rows display per page
$columnIndex = $dtpostData->order[0]->column; // Column index
$columnName = $dtpostData->columns[$columnIndex]->data; // Column name
$columnSortOrder = $dtpostData->order[0]->dir; // asc or desc
$searchValue = $dtpostData->search->value; // Search value
//Total number of records without filtering
$totalRecords = $this->user_model->select('id_user')
->join('auth_user_group','auth_user_group.token = auth_user.group')
->countAllResults();
//Total number of records with filtering
$totalRecordwithFilter = $this->user_model->select('id_user')
->join('auth_user_group','auth_user_group.token = auth_user.group')
->orLike('first_name', $searchValue)
->orLike('email', $searchValue)
->countAllResults();
//Fetch records
$records = $this->user_model->select('auth_user.*,auth_user_group.title')
->join('auth_user_group','auth_user_group.token = auth_user.group')
->orLike('first_name', $searchValue)
->orLike('email', $searchValue)
->orderBy($columnName,$columnSortOrder)
->findAll($rowperpage, $start);
//Format records
foreach ($records as $key => $value){
if($records[$key]['email_confirmed'] == 1){
$records[$key]['email'] = $records[$key]['email'].' '.'<span class="text-success"><i class="fas fa-check-circle"></i></span>';
}
$editLink = site_url('user/edit/').$records[$key]['token'];
$records[$key]['options'] = ''.
'<div class="btn-group mr-1 mb-1" xmlns="http://www.w3.org/1999/html">
<button type="button" class="btn btn-primary btn-block dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
'.lang("App.user_grid_options").'
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="'.$editLink.'"><i class="fas fa-edit"></i> '.lang("App.user_btn_edit").'</a>
<button type="button" class="dropdown-item" onclick="delete_user(\''.$records[$key]['token'].'\');"><i class="fas fa-trash"></i> '.lang("App.user_btn_delete").'</button>
</div>
</div>
';
}
//Data records
$data = array();
foreach($records as $record ){
$data[] = array(
"first_name"=>$record['first_name'],
"email"=>$record['email'],
"group"=>$record['title'],
"mobile"=>$record['mobile'],
"last_access"=>$record['last_access'],
"last_ip"=>$record['last_ip'],
"created_at"=>$record['created_at'],
"options"=>$record['options']
);
}
//Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data,
"token" => csrf_hash() // New token hash
);
return $this->response->setJSON($response);
}else{
return $this->response->setJSON(["error"=>true]);
}
}
public function getGroups(){
$postData = service('request')->getVar();
if($postData != null && isset($postData->data)){
$dtpostData = $postData->data;
//Read value
$draw = $dtpostData->draw;
$start = $dtpostData->start;
$rowperpage = $dtpostData->length; // Rows display per page
$columnIndex = $dtpostData->order[0]->column; // Column index
$columnName = $dtpostData->columns[$columnIndex]->data; // Column name
$columnSortOrder = $dtpostData->order[0]->dir; // asc or desc
$searchValue = $dtpostData->search->value; // Search value
//Total number of records without filtering
$totalRecords = $this->group_model->select('id_group')
->countAllResults();
//Total number of records with filtering
$totalRecordwithFilter = $this->group_model->select('id_group')
->orLike('title', $searchValue)
->countAllResults();
//Fetch records
$records = $this->group_model->select('*')
->orLike('title', $searchValue)
->orderBy($columnName,$columnSortOrder)
->findAll($rowperpage, $start);
//Format records
foreach ($records as $key => $value){
$editLink = site_url('group/edit/').$records[$key]['token'];
$records[$key]['options'] = ''.
'<div class="btn-group mr-1 mb-1" xmlns="http://www.w3.org/1999/html">
<button type="button" class="btn btn-primary btn-block dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
'.lang("App.group_grid_options").'
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="'.$editLink.'"><i class="fas fa-edit"></i> '.lang("App.group_btn_edit").'</a>
<button type="button" class="dropdown-item" onclick="delete_group(\''.$records[$key]['token'].'\');"><i class="fas fa-trash"></i> '.lang("App.group_btn_delete").'</button>
</div>
</div>
';
}
//Data records
$data = array();
foreach($records as $record ){
$data[] = array(
"title"=>$record['title'],
"dashboard"=>$record['dashboard'],
"created_at"=>$record['created_at'],
"updated_at"=>$record['updated_at'],
"options"=>$record['options']
);
}
//Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data,
"token" => csrf_hash() // New token hash
);
return $this->response->setJSON($response);
}else{
return $this->response->setJSON(["error"=>true]);
}
}
public function getActivities($all=""){
$postData = service('request')->getVar();
if($postData != null && isset($postData->data)){
$dtpostData = $postData->data;
//Read value
$draw = $dtpostData->draw;
$start = $dtpostData->start;
$rowperpage = $dtpostData->length; // Rows display per page
$columnIndex = $dtpostData->order[0]->column; // Column index
$columnName = $dtpostData->columns[$columnIndex]->data; // Column name
$columnSortOrder = $dtpostData->order[0]->dir; // asc or desc
$searchValue = $dtpostData->search->value; // Search value
$session = session();
//Total number of records without filtering
if($session->get('dashboard')=='admin' && !empty($all)){
$totalRecords = $this->activity_model->select('id_activity')
->join('user','user.token = activity.user')
->countAllResults();
}else{
$totalRecords = $this->activity_model->select('id_activity')
->join('user','user.token = activity.user')
->where('activity.user',$session->get('token'))
->countAllResults();
}
//Total number of records with filtering
if($session->get('dashboard')=='admin' && !empty($all)){
$totalRecordwithFilter = $this->activity_model->select('id_activity')
->join('user','user.token = activity.user')
->orLike('first_name', $searchValue)
->countAllResults();
}else{
$totalRecordwithFilter = $this->activity_model->select('id_activity')
->join('user','user.token = activity.user')
->orLike('first_name', $searchValue)
->where('activity.user',$session->get('token'))
->countAllResults();
}
//Fetch records
if($session->get('dashboard')=='admin' && !empty($all)){
$records = $this->activity_model->select('activity.*,concat(first_name, " (",email, ")") AS name')
->join('user','user.token = activity.user')
->orLike('first_name', $searchValue)
->orderBy($columnName,$columnSortOrder)
->findAll($rowperpage, $start);
}else{
$records = $this->activity_model->select('activity.*,concat(first_name, " (",email, ")") AS name')
->join('user','user.token = activity.user')
->orLike('first_name', $searchValue)
->where('activity.user',$session->get('token'))
->orderBy($columnName,$columnSortOrder)
->findAll($rowperpage, $start);
}
//Data records
$data = array();
foreach($records as $record ){
$data[] = array(
"name"=>$record['name'],
"level"=>$record['level'],
"event"=>$record['event'],
"ip"=>$record['ip'],
"os"=>$record['os'],
"browser"=>$record['browser'],
"created_at"=>$record['created_at']
);
}
//Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data,
"token" => csrf_hash() // New token hash
);
return $this->response->setJSON($response);
}else{
return $this->response->setJSON(["error"=>true]);
}
}
public function getCronHistory(){
$postData = service('request')->getVar();
if($postData != null && isset($postData->data)){
$dtpostData = $postData->data;
//Read value
$draw = $dtpostData->draw;
$start = $dtpostData->start;
$rowperpage = $dtpostData->length; // Rows display per page
$columnIndex = $dtpostData->order[0]->column; // Column index
$columnName = $dtpostData->columns[$columnIndex]->data; // Column name
$columnSortOrder = $dtpostData->order[0]->dir; // asc or desc
$searchValue = $dtpostData->search->value; // Search value
//Total number of records without filtering
$totalRecords = $this->crontab_model->select('id_crontab')
->countAllResults();
//Total number of records with filtering
$totalRecordwithFilter = $this->crontab_model->select('id_crontab')
->orLike('routine', $searchValue)
->orLike('error', $searchValue)
->countAllResults();
//Fetch records
$records = $this->crontab_model->select('*')
->orLike('routine', $searchValue)
->orLike('error', $searchValue)
->orderBy($columnName,$columnSortOrder)
->findAll($rowperpage, $start);
//Data records
$data = array();
foreach($records as $record ){
$data[] = array(
"routine"=>$record['routine'],
"error"=>$record['error'],
"created_at"=>$record['created_at']
);
}
//Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data,
"token" => csrf_hash() // New token hash
);
return $this->response->setJSON($response);
}else{
return $this->response->setJSON(["error"=>true]);
}
}
public function getNotification(){
$postData = service('request')->getVar();
if($postData != null && isset($postData->data)){
$dtpostData = $postData->data;
//Read value
$draw = $dtpostData->draw;
$start = $dtpostData->start;
$rowperpage = $dtpostData->length; // Rows display per page
$columnIndex = $dtpostData->order[0]->column; // Column index
$columnName = $dtpostData->columns[$columnIndex]->data; // Column name
$columnSortOrder = $dtpostData->order[0]->dir; // asc or desc
$searchValue = $dtpostData->search->value; // Search value
//Total number of records without filtering
$totalRecords = $this->notification_model->select('id_notification')
->join('user AS sender','notification.user_sender = sender.token','left')
->join('user AS recipient','notification.user_recipient = recipient.token','left')
->countAllResults();
//Total number of records with filtering
$totalRecordwithFilter = $this->notification_model->select('id_notification')
->join('user AS sender','notification.user_sender = sender.token','left')
->join('user AS recipient','notification.user_recipient = recipient.token','left')
->orLike('title', $searchValue)
->orLike('sender.first_name', $searchValue)
->orLike('recipient.first_name', $searchValue)
->countAllResults();
//Fetch records
$records = $this->notification_model->select('notification.token, sender.first_name AS sender, recipient.first_name AS recipient, notification.title, is_send_email, is_read, notification.created_at')
->join('user AS sender','notification.user_sender = sender.token','left')
->join('user AS recipient','notification.user_recipient = recipient.token','left')
->orLike('title', $searchValue)
->orLike('sender.first_name', $searchValue)
->orLike('recipient.first_name', $searchValue)
->orderBy($columnName,$columnSortOrder)
->findAll($rowperpage, $start);
//Format records
foreach ($records as $key => $value){
$records[$key]['options'] = ''.
'<div class="btn-group mr-1 mb-1" xmlns="http://www.w3.org/1999/html">
<button type="button" class="btn btn-primary btn-block dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
'.lang("App.notification_grid_options").'
</button>
<div class="dropdown-menu">
<button type="button" class="dropdown-item" onclick="delete_this(\''.$records[$key]['token'].'\');"><i class="fas fa-trash"></i> '.lang("App.user_btn_delete").'</button>
</div>
</div>
';
}
//Data records
$data = array();
foreach($records as $record ){
$data[] = array(
"sender"=>$record['sender'],
"recipient"=>$record['recipient'],
"title"=>$record['title'],
"is_send_email"=>$record['is_send_email'],
"is_read"=>$record['is_read'],
"created_at"=>$record['created_at'],
"options"=>$record['options']
);
}
//Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data,
"token" => csrf_hash() // New token hash
);
return $this->response->setJSON($response);
}else{
return $this->response->setJSON(["error"=>true]);
}
}
public function getMyNotification(){
$postData = service('request')->getVar();
if($postData != null && isset($postData->data)){
$dtpostData = $postData->data;
//Read value
$draw = $dtpostData->draw;
$start = $dtpostData->start;
$rowperpage = $dtpostData->length; // Rows display per page
$columnIndex = $dtpostData->order[0]->column; // Column index
$columnName = $dtpostData->columns[$columnIndex]->data; // Column name
$columnSortOrder = $dtpostData->order[0]->dir; // asc or desc
$searchValue = $dtpostData->search->value; // Search value
//Total number of records without filtering
$totalRecords = $this->notification_model->select('id_notification')
->join('user AS sender','notification.user_sender = sender.token','left')
->join('user AS recipient','notification.user_recipient = recipient.token','left')
->where('user_recipient',$this->token_user)
->countAllResults();
//Total number of records with filtering
$totalRecordwithFilter = $this->notification_model->select('id_notification')
->join('user AS sender','notification.user_sender = sender.token','left')
->join('user AS recipient','notification.user_recipient = recipient.token','left')
->orLike('title', $searchValue)
->where('user_recipient',$this->token_user)
->countAllResults();
//Fetch records
$records = $this->notification_model->select('notification.token, sender.first_name AS sender, recipient.first_name AS recipient, notification.title, is_read, notification.created_at')
->join('user AS sender','notification.user_sender = sender.token','left')
->join('user AS recipient','notification.user_recipient = recipient.token','left')
->orLike('title', $searchValue)
->where('user_recipient',$this->token_user)
->orderBy($columnName,$columnSortOrder)
->findAll($rowperpage, $start);
//Format records
foreach ($records as $key => $value){
$records[$key]['options'] = '<a class="btn btn-primary" href="/my/notification_view/'.$records[$key]['token'].'"><i class="fas fa-eye"></i> '.lang("App.notification_view_btn").'</a>';
}
//Data records
$data = array();
foreach($records as $record ){
$data[] = array(
"sender"=>$record['sender'],
"recipient"=>$record['recipient'],
"title"=>$record['title'],
"created_at"=>$record['created_at'],
"is_read"=>$record['is_read'],
"options"=>$record['options']
);
}
//Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => $totalRecords,
"iTotalDisplayRecords" => $totalRecordwithFilter,
"aaData" => $data,
"token" => csrf_hash() // New token hash
);
return $this->response->setJSON($response);
}else{
return $this->response->setJSON(["error"=>true]);
}
}
}

273
ci4/app/Controllers/Api.php Normal file
View File

@ -0,0 +1,273 @@
<?php
namespace App\Controllers;
use App\Libraries\PasswordHash;
use App\Models\SettingsModel;
use App\Models\UserModel;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\RESTful\ResourceController;
use CodeIgniter\Validation\Exceptions\ValidationException;
use Config\Services;
class Api extends ResourceController
{
private $user_model;
private $settings_model;
private $data_format;
function __construct()
{
$this->user_model = new UserModel();
$this->settings_model = new SettingsModel();
$this->data_format = getenv('api.return')??'json';
}
public function index()
{
return $this->response->setJSON([
'message' => 'Welcome!'
]);
}
public function status()
{
return $this->response->setJSON([
'status' => true,
'message' => 'The system is running!'
]);
}
public function signIn()
{
$rules = [
'email' => 'required|valid_email|validateAuthPermission[email]',
'password' => 'required|validateAuthPassword[email, password]'
];
$errors = [
'email' => [
'required' => 'The email field is required.',
'valid_email' => 'Invalid email.',
'validateAuthPermission' => 'This user {value} does not have access permission.'
],
'password' => [
'required' => 'The password field is required.',
'validateAuthPassword' => 'Invalid password.'
]
];
$input = $this->baseRequest($this->request);
if (!$this->baseValidateRequest($input, $rules, $errors)) {
return $this->baseResponse($this->validator->getErrors(),ResponseInterface::HTTP_BAD_REQUEST);
}
return $this->generateCredential($input['email']);
}
private function generateCredential(string $email, int $responseCode = ResponseInterface::HTTP_OK){
try {
helper('jwt');
return $this->baseResponse([
'access_token' => jwtSignature($email)
]);
} catch (\Exception $exception) {
return $this->baseResponse(['error' => $exception->getMessage()], $responseCode);
}
}
private function baseResponse(array $responseBody, int $code = ResponseInterface::HTTP_OK)
{
if($this->data_format == 'json'){
return $this->response->setStatusCode($code)->setJSON($responseBody)??'';
}else{
return $this->response->setStatusCode($code)->setXML($responseBody)??'';
}
}
private function baseRequest(IncomingRequest $request){
return $request->getVar()??[];
}
private function baseValidateRequest(array $input, array $rules, array $messages = []){
$this->validator = Services::Validation()->setRules($rules);
if (is_string($rules)) {
$validation = config('Validation');
if (!isset($validation->$rules)) {
throw ValidationException::forRuleNotFound($rules);
}
if (!$messages) {
$errorName = $rules . '_errors';
$messages = $validation->$errorName ?? [];
}
$rules = $validation->$rules;
}
return $this->validator->setRules($rules, $messages)->run($input);
}
public function user($method = null, $key = null)
{
switch ($method):
/**
* Return all users.
*/
case 'all':
try {
$data = $this->user_model->select('token,first_name,last_name,date_birth,email,mobile,picture,language,address,address,state,country,zip_code,status,created_at,updated_at')->findAll()??[];
return $this->setResponseFormat($this->data_format)->respond($data);
} catch (\Exception $exception) {
return $this->setResponseFormat($this->data_format)->respond([
'error' => true,
'message' => $exception->getMessage()
]);
}
/**
* Return user for token id.
*/
case 'id':
try {
$data = $this->user_model->select('token,first_name,last_name,date_birth,email,mobile,picture,language,address,address,state,country,zip_code,status,created_at,updated_at')->where('token',$key)->first()??[];
return $this->setResponseFormat($this->data_format)->respond($data);
} catch (\Exception $exception) {
return $this->setResponseFormat($this->data_format)->respond([
'error' => true,
'message' => $exception->getMessage()
]);
}
/**
* Return add user.
*/
case 'add':
try {
$body = $this->request->getVar() == [] ? (array) $this->request->getJSON() : $this->request->getVar();
if(empty($body["first_name"]??"")){
return $this->setResponseFormat($this->data_format)->respond([
'error' => true,
'message' => 'The first name parameter is null or empty.'
]);
}
if(empty($body["last_name"]??"")){
return $this->setResponseFormat($this->data_format)->respond([
'error' => true,
'message' => 'The last name parameter is null or empty.'
]);
}
if(empty($body["email"]??"")){
return $this->setResponseFormat($this->data_format)->respond([
'error' => true,
'message' => 'The email parameter is null or empty.'
]);
}else{
$validate = $this->user_model->where('email',$body["email"]??"")->countAllResults();
if($validate > 0){
return $this->setResponseFormat($this->data_format)->respond([
'error' => true,
'message' => 'Email already registered!'
]);
}
}
if(empty($body["password"]??"")){
return $this->setResponseFormat($this->data_format)->respond([
'error' => true,
'message' => 'The password parameter is null or empty.'
]);
}else{
if(strlen($body["password"]??"") < 8){
return $this->setResponseFormat($this->data_format)->respond([
'error' => true,
'message' => 'Password must be at least 8 characters long.'
]);
}
}
$settings = $this->settings_model->first()??[];
$phpass = new PasswordHash(8, true);
$token = md5(uniqid(rand(), true));
$this->user_model->save([
'group' => $settings['default_role'],
'first_name' => $body['first_name'],
'last_name' => $body['last_name'],
'mobile' => '',
'picture' => '/assets/img/default-user.png',
'email' => $body['email'],
'password' => $phpass->HashPassword($body['password']),
'last_access' => date('Y-m-d h:i:s'),
'last_ip' => '::1',
'language' => $settings['default_language'],
'token' => $token,
'status' => true
]);
$data = $this->user_model->select('token,first_name,last_name,date_birth,email,mobile,picture,language,address,address,state,country,zip_code,status,created_at,updated_at')->where('token',$token)->first()??[];
return $this->setResponseFormat($this->data_format)->respond([
'error' => false,
'message' => 'Added successfully!',
'data' => $data??[]
]);
} catch (\Exception $exception) {
return $this->setResponseFormat($this->data_format)->respond([
'error' => true,
'message' => $exception->getMessage()
]);
}
/**
* Return edit user.
*/
case 'edit':
try {
$data = $this->user_model->where('token',$key)->first()??[];
if($data == []){
return $this->setResponseFormat($this->data_format)->respond([
'error' => true,
'message' => 'User not found!'
]);
}
$body = $this->request->getVar() == [] ? (array) $this->request->getJSON() : $this->request->getVar();
$this->user_model->save([
'id_user' => $data['id_user'],
'first_name' => empty($body["first_name"]??"")?$data['first_name']:$body["first_name"]??"",
'last_name' => empty($body["last_name"]??"")?$data['last_name']:$body["last_name"]??"",
'date_birth' => empty($body["date_birth"]??"")?$data['date_birth']:$body["date_birth"]??"",
'address' => empty($body["address"]??"")?$data['address']:$body["address"]??"",
'city' => empty($body["city"]??"")?$data['city']:$body["city"]??"",
'state' => empty($body["state"]??"")?$data['state']:$body["state"]??"",
'country' => empty($body["country"]??"")?$data['country']:$body["country"]??"",
'zip_code' => empty($body["zip_code"]??"")?$data['zip_code']:$body["zip_code"]??"",
'mobile' => empty($body["mobile"]??"")?$data['mobile']:$body["mobile"]??"",
'status' => empty($body["status"]??"")?$data['status']:$body["status"]??""
]);
$data = $this->user_model->select('token,first_name,last_name,date_birth,email,mobile,picture,language,address,address,state,country,zip_code,status,created_at,updated_at')->where('token',$key)->first()??[];
return $this->setResponseFormat($this->data_format)->respond([
'error' => false,
'message' => 'Successfully Edited!',
'data' => $data??[]
]);
} catch (\Exception $exception) {
return $this->setResponseFormat($this->data_format)->respond([
'error' => true,
'message' => $exception->getMessage()
]);
}
/**
* Return delete user.
*/
case 'delete':
try {
$this->user_model->where('token', $key)->delete();
return $this->setResponseFormat($this->data_format)->respond([
'error' => false,
'message' => 'Successfully deleted!'
]);
} catch (\Exception $exception) {
return $this->setResponseFormat($this->data_format)->respond([
'error' => true,
'message' => $exception->getMessage()
]);
}
/**
* Return Default.
*/
default:
return $this->setResponseFormat($this->data_format)->respond([
'error' => true,
'message' => 'Method call is invalid.'
]);
endswitch;
}
}

View File

@ -0,0 +1,80 @@
<?php
namespace App\Controllers;
use App\Models\NotificationModel;
use App\Models\SettingsModel;
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 = ['general','jwt'];
/**
* 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();
$session = \Config\Services::session();
// Language Validate
$language = \Config\Services::language();
$language->setLocale($session->lang);
// Set TimeZone
if(empty($session->get('settings'))){
$settingsModel = new SettingsModel();
$settings = $settingsModel->select('default_timezone')->first()??[];
date_default_timezone_set($settings['default_timezone']??'America/Sao_Paulo');
}else{
date_default_timezone_set($session->get('settings')['default_timezone']??'America/Sao_Paulo');
}
// Get notification
if(!empty($session->get('token'))) {
$notificationModel = new NotificationModel();
$pulse = $notificationModel->where('user_recipient',$session->get('token'))->where('is_read',false)->countAllResults() ?? 0;
$notification = $notificationModel->select('token,title,is_read,created_at')->where('user_recipient',$session->get('token'))->orderBy('created_at','desc')->findAll(5) ?? [];
$session->set('notification', $notification);
$session->set('pulse', $pulse);
}else{
$session->set('notification', []);
$session->set('pulse', 0);
}
}
}

View File

@ -0,0 +1,88 @@
<?php
namespace App\Controllers;
use App\Models\ActivityModel;
use App\Models\BackupModel;
use App\Models\CronTabModel;
use App\Models\NotificationModel;
use App\Models\SettingsModel;
use App\Models\UserModel;
class Cron extends BaseController
{
private $integration;
private $user_model;
private $notification_model;
private $crontab_model;
private $settings_model;
private $activity_model;
private $backup_model;
function __construct()
{
$this->integration = new Integration();
$this->user_model = new UserModel();
$this->notification_model = new NotificationModel();
$this->settings_model = new SettingsModel();
$this->crontab_model = new CronTabModel();
$this->activity_model = new ActivityModel();
$this->backup_model = new BackupModel();
}
public function index()
{
$settings = $this->settings_model->first()??[];
// Cron Notification E-mail
try {
$email_list = $this->notification_model
->select('notification.id_notification, recipient.email, notification.title, notification.body')
->join('user AS recipient','notification.user_recipient = recipient.token','left')
->where('send_email_notification',true)
->where('is_send_email',false)
->orderBy('notification.id_notification','desc')
->findAll(25);
foreach ($email_list as $item){
if($this->integration->send_email($item['email'],$item['title'],$item['body'])){
$this->notification_model->save(['id_notification' => $item['id_notification'],'is_send_email' => true]);
}
}
}catch (\Exception $e){
$this->crontab_model->save(['routine'=>'Notification Email','error'=>$e->getMessage()]);
}
// Cron Backup
if(date('Y-m-d') > date('Y-m-d',strtotime($settings['backup_latest']))){
if(date('H:i:s') >= date('H:i:s',strtotime($settings['backup_time']))){
try {
$this->settings_model->save([
'id_settings' => $settings['id_settings'],
'backup_latest' => date('Y-m-d H:i:s')
]);
$this->integration->create_backup();
}catch (\Exception $e){
$this->crontab_model->save(['routine'=>'Backup','error'=>$e->getMessage()]);
}
}
}
// Cron Log Delete
if(date('Y-m-d') >= date('Y-m-d',strtotime(date($settings['remove_log_latest']) . ' +'.$settings['remove_log_time'].' day'))){
try {
$this->settings_model->save([
'id_settings' => $settings['id_settings'],
'remove_log_latest' => date('Y-m-d H:i:s')
]);
$dateStart = date('Y-m-d H:i:s',strtotime(date('Y-m-d H:i:s') . ' -5 year'));
$dateEnd = date('Y-m-d H:i:s',strtotime(date('Y-m-d H:i:s') . ' -30 day'));
$this->crontab_model->where('created_at between "'.$dateStart.'" and "'.$dateEnd.'"')->delete();
$this->activity_model->where('created_at between "'.$dateStart.'" and "'.$dateEnd.'"')->delete();
$this->backup_model->where('created_at between "'.$dateStart.'" and "'.$dateEnd.'"')->delete();
}catch (\Exception $e){
$this->crontab_model->save(['routine'=>'Delete Log','error'=>$e->getMessage()]);
}
}
}
}

View File

@ -0,0 +1,212 @@
<?php
namespace App\Controllers;
use App\Models\UserModel;
use App\Models\UserGroupModel;
class Group extends BaseController
{
private $user_model;
private $group_model;
function __construct()
{
$this->user_model = new UserModel();
$this->group_model = new UserGroupModel();
}
public function index()
{
$data['title'] = [
'module' => lang("App.group_title"),
'page' => lang("App.group_subtitle"),
'icon' => 'fas fa-user-lock'
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.group_title"), 'route' => "", 'active' => true]
];
$data['btn_add'] = [
'title' => lang("App.group_btn_add"),
'route' => '/group/add',
'class' => 'btn btn-lg btn-primary float-md-right',
'icon' => 'fas fa-plus'
];
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/group/index',$data);
echo view(getenv('theme.path').'main/footer');
}
public function add()
{
helper('form');
$data['title'] = [
'module' => lang("App.group_add_title"),
'page' => lang("App.group_add_subtitle"),
'icon' => 'far fa-plus-square'
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.group_title"), 'route' => "/group", 'active' => false],
['title' => lang("App.group_add_title"), 'route' => "", 'active' => true]
];
$data['btn_return'] = [
'title' => lang("App.global_come_back"),
'route' => '/group',
'class' => 'btn btn-dark mr-1',
'icon' => 'fas fa-angle-left'
];
$data['btn_submit'] = [
'title' => lang("App.global_save"),
'route' => '',
'class' => 'btn btn-primary mr-1',
'icon' => 'fas fa-save'
];
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/group/form',$data);
echo view(getenv('theme.path').'main/footer');
}
public function edit($id)
{
helper('form');
$data['title'] = [
'module' => lang("App.group_edit_title"),
'page' => lang("App.group_edit_subtitle"),
'icon' => 'fas fa-edit'
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.group_title"), 'route' => "/group", 'active' => false],
['title' => lang("App.group_edit_title"), 'route' => "", 'active' => true]
];
$data['btn_return'] = [
'title' => lang("App.global_come_back"),
'route' => '/group',
'class' => 'btn btn-dark mr-1',
'icon' => 'fas fa-angle-left'
];
$data['btn_submit'] = [
'title' => lang("App.global_save"),
'route' => '',
'class' => 'btn btn-primary mr-1',
'icon' => 'fas fa-save'
];
$data['obj'] = $this->group_model->where('token', $id)->first();
if($data['obj']==null){
return redirect()->to('/group');
}
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/group/form',$data);
echo view(getenv('theme.path').'main/footer');
}
public function store()
{
//Demo Mode
if(env('demo.mode')??false){
session()->setFlashdata('sweet', ['warning',lang("App.general_demo_mode")]);
return redirect()->to('/group');
}
$session = session();
helper('form');
$rules = [
'title' => 'required',
'dashboard' => 'required'
];
$rules_error = [
'title' => [
'required' => lang("App.group_rules_title_r")
],
'dashboard' => [
'required' => lang("App.group_rules_dashboard_r")
],
];
if ($this->validate($rules,$rules_error)){
if($listPost = $this->request->getPost()){
$getChecked = $this->request->getPost();
unset($getChecked['id_group']);
unset($getChecked['title']);
unset($getChecked['dashboard']);
$controller = null;
$rules_access = null;
foreach ($getChecked as $key=>$value){
$exp = explode('_',$key);
$controller[] = $exp[0];
}
if($controller != null){
foreach (array_unique($controller) as $item){
$rules_access[$item] = [];
foreach ($getChecked as $key=>$value){
$exp = explode('_',$key);
if($exp[0] == $item){
array_push($rules_access[$item],str_replace($exp[0].'_','',$key)) ;
}
}
}
}
$listPost['rules'] = json_encode($rules_access??'{}');
if(empty($listPost['id_group'])){
$listPost['token'] = md5(uniqid(rand(), true));
}
$this->group_model->save($listPost);
if(empty($listPost['id_group'])){
$session->setFlashdata('sweet', ['success',lang("App.group_alert_add")]);
return redirect()->to('/group');
}else{
if($session->get('group') == $this->request->getPost('token')){
$session->set('rules', $listPost['rules']);
}
$session->setFlashdata('sweet', ['success',lang("App.group_alert_edit")]);
return redirect()->to('/group');
}
}
}else{
$session->setFlashdata('error','error');
$this->add();
}
}
public function delete($id)
{
//Demo Mode
if(env('demo.mode')??false){
session()->setFlashdata('sweet', ['warning',lang("App.general_demo_mode")]);
return redirect()->to('/group');
}
$session = session();
if($this->user_model->where('group', $id)->countAllResults() == 0){
$this->group_model->where('token', $id)->delete();
$session->setFlashdata('sweet', ['success',lang("App.group_alert_delete")]);
}else{
$session->setFlashdata('sweet', ['error',lang("App.group_alert_error")]);
}
return redirect()->to('/group');
}
}

View File

@ -0,0 +1,152 @@
<?php
namespace App\Controllers;
use App\Models\ActivityModel;
use App\Models\UserModel;
class Home extends BaseController
{
private $user_model;
private $activity_model;
function __construct()
{
$this->user_model = new UserModel();
$this->activity_model = new ActivityModel();
}
public function index()
{
$session = session();
$id_user = $session->get('id_user');
$name = $session->get('first_name');
$hora = date('H');
//Salutation
if( $hora >= 6 && $hora <= 12 )
$salutation = lang("App.dashboard_good_morning");
else if ( $hora > 12 && $hora <=18 )
$salutation = lang("App.dashboard_good_afternoon");
else
$salutation = lang("App.dashboard_good_night");
switch ($session->get('dashboard')):
case 'admin':
$data['title'] = [
'module' => lang("App.dashboard_hello").' '.$name,
'page' => lang("App.dashboard_indicators"),
'icon' => ''
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "", 'active' => true]
];
//Cards Top
$initialDate = date('Y-m-d H:i:s', strtotime('-1 day', time()));
$finalDate = date('Y-m-d H:i:s');
$data['total_user'] = $this->user_model->countAllResults();
$data['total_new'] = $this->user_model->where('created_at between \''.$initialDate.'\' and \''.$finalDate.'\'')->countAllResults();
$data['total_enabled'] = $this->user_model->where('status',true)->countAllResults();
$data['total_disabled'] = $this->user_model->where('status',false)->countAllResults();
//Char Bar
$titles_char_bar["labels"] = explode(',',lang("App.dashboard_chart_months"));
$value_char_bar["series"] = [];
$return_char_bar_geral = $this->user_model->select("DATE_FORMAT(created_at,'%m') AS month,COUNT(DATE_FORMAT(created_at,'%m')) AS total")
->where("DATE_FORMAT(NOW(),'%Y') = DATE_FORMAT(created_at,'%Y')")
->groupBy("DATE_FORMAT(created_at,'%Y-%m')")
->findAll();
$return_char_bar_enabled = $this->user_model->select("DATE_FORMAT(created_at,'%m') AS month,COUNT(DATE_FORMAT(created_at,'%m')) AS total")
->where("DATE_FORMAT(NOW(),'%Y') = DATE_FORMAT(created_at,'%Y') AND status = true")
->groupBy("DATE_FORMAT(created_at,'%Y-%m')")
->findAll();
$return_char_bar_disabled = $this->user_model->select("DATE_FORMAT(updated_at,'%m') AS month,COUNT(DATE_FORMAT(updated_at,'%m')) AS total")
->where("DATE_FORMAT(NOW(),'%Y') = DATE_FORMAT(updated_at,'%Y') AND status = false")
->groupBy("DATE_FORMAT(updated_at,'%Y-%m')")
->findAll();
$year = [];
for ($i = 1; $i <= 12; $i++) {
$notFound = true;
foreach ($return_char_bar_geral as $item){
if($i == intval($item['month'])){
array_push($year,intval($item['total']));
$notFound = false;
break;
}
}
if($notFound){
array_push($year,0);
}
}
array_push($value_char_bar["series"],$year);
$year = [];
for ($i = 1; $i <= 12; $i++) {
$notFound = true;
foreach ($return_char_bar_enabled as $item){
if($i == intval($item['month'])){
array_push($year,intval($item['total']));
$notFound = false;
break;
}
}
if($notFound){
array_push($year,0);
}
}
array_push($value_char_bar["series"],$year);
$year = [];
for ($i = 1; $i <= 12; $i++) {
$notFound = true;
foreach ($return_char_bar_disabled as $item){
if($i == intval($item['month'])){
array_push($year,intval($item['total']));
$notFound = false;
break;
}
}
if($notFound){
array_push($year,0);
}
}
array_push($value_char_bar["series"],$year);
$data['data_char_bar'] = json_encode(array_merge($titles_char_bar,$value_char_bar));
$data['data_user'] = $this->user_model->select('picture,first_name,last_name,email,created_at')
->orderBy('id_user','DESC')
->findAll(15);
$data['data_activity'] = $this->activity_model
->select('auth_user.first_name,auth_user.email,auth_activity.detail,auth_activity.created_at')
->join('auth_user','auth_user.token=auth_activity.user')
->orderBy('auth_activity.id_activity','DESC')
->findAll(30);
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/dashboard/admin',$data);
echo view(getenv('theme.path').'main/footer');
break;
case 'user':
$data['title'] = [
'module' => lang("App.dashboard_hello").' '.$name,
'page' => lang("App.dashboard_indicators"),
'icon' => ''
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "", 'active' => true]
];
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/dashboard/user',$data);
echo view(getenv('theme.path').'main/footer');
break;
default:
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/dashboard/index');
echo view(getenv('theme.path').'main/footer');
endswitch;
}
}

View File

@ -0,0 +1,515 @@
<?php
namespace App\Controllers;
use App\Models\ActivityModel;
use App\Models\PasswordRecoveryModel;
use App\Models\SettingsModel;
use App\Models\TemplateModel;
use App\Models\UserModel;
use App\Libraries\PasswordHash;
use CodeIgniter\HTTP\Files\FileCollection;
class Integration extends BaseController
{
private $user_model;
private $settings_model;
private $pass_recovery_model;
private $template_model;
private $activity_model;
private $id_user;
private $token_user;
function __construct()
{
$this->user_model = new UserModel();
$this->settings_model = new SettingsModel();
$this->pass_recovery_model = new PasswordRecoveryModel();
$this->template_model = new TemplateModel();
$this->activity_model = new ActivityModel();
$this->id_user = session()->get('id_user');
$this->token_user = session()->get('token');
}
public function index()
{
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/dashboard/index');
echo view(getenv('theme.path').'main/footer');
}
public function send_email($email='',$subject='',$body='',$key='',$json=false){
if(empty($email)){
return $json ? json_encode(["return" => false]) : false;
}
$phpass = new PasswordHash(8, true);
if(!$phpass->CheckPassword(MD5($email), $key)){
return $json ? json_encode(["return" => false]) : false;
}
$user = $this->user_model->where('email',$email??null)->first();
if(!empty($user)){
foreach (keywordEmail()??[] as $item){
$field = str_replace(['[','user_',']'],'',$item);
$body = str_replace('['.$item.']',$user[$field],$body);
}
}
if($this->sendMail($subject,unescape($body),$email)){
return $json ? json_encode(["return" => true]) : true;
}else{
return $json ? json_encode(["return" => false]) : false;
}
}
public function send_email_test($email=''){
$token = session()->get('token')??'';
if(!empty($token)){
if(empty($email)){
return $this->response->setJSON(["return" => false]);
}
$subject = "Email Test";
$body = "Email working successfully!";
if($this->sendMail($subject,unescape($body),$email)){
return $this->response->setJSON(["return" => true]);
}else{
return $this->response->setJSON(["return" => false]);
}
}else{
return $this->response->setJSON(["return" => false]);
}
}
public function reset_password(){
$session = session();
$settings = $session->get('settings');
helper('text');
if($listPost = $this->request->getPost()){
// Captcha Validation
if($settings['captcha_recovery']??false){
if($settings['captcha_gateway'] == 'recaptcha'){
if(isset($listPost['g-recaptcha-response'])){
$captcha = $listPost['g-recaptcha-response'];
$url = 'https://www.google.com/recaptcha/api/siteverify?secret='.urlencode($settings['captcha_secret_key']??'').'&response='.urlencode($captcha);
$response = file_get_contents($url);
$responseKeys = json_decode($response,true);
if(!$responseKeys["success"]) {
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_captcha_invalid")]);
return redirect()->to('/login/forgot_password');
}
}else{
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_captcha_not_found")]);
return redirect()->to('/login/forgot_password');
}
}
if($settings['captcha_gateway'] == 'hcaptcha'){
if(isset($listPost['h-captcha-response'])){
$captcha = $listPost['h-captcha-response'];
$url = 'https://hcaptcha.com/siteverify?secret='.urlencode($settings['captcha_secret_key']??'').'&response='.urlencode($captcha).'&remoteip='.$_SERVER['REMOTE_ADDR'];
$response = file_get_contents($url);
$responseKeys = json_decode($response,true);
if(!$responseKeys["success"]) {
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_captcha_invalid")]);
return redirect()->to('/login/forgot_password');
}
}else{
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_captcha_not_found")]);
return redirect()->to('/login/forgot_password');
}
}
}
$user = $this->user_model->where('email',$listPost['email']??null)->first();
if(empty($user)){
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_user_not_found")]);
return redirect()->to('/login/forgot_password');
}
$template = $this->template_model->where('id_template',1)->first();
foreach (keywordEmail()??[] as $item){
$field = str_replace(['[','user_',']'],'',$item);
$template = str_replace('['.$item.']',$user[$field],$template);
}
$token = random_string("alnum", 50);
$url = base_url().'/login/recovery/'.$token;
$this->pass_recovery_model->save([
'user' => $user['token'],
'token' => $token
]);
$title = $template['subject']??'';
$msg = $template['body']??'';
$msg = str_replace('[recovery_password]',$url,$msg);
$email = $user['email'];
$this->setLog('recovery','recovery-password',$user['token']);
$send = $this->sendMail($title,$msg,$email);
if($send){
$session->setFlashdata('toast', ['success',lang("App.login_alert_send"),lang("App.login_alert_send_pass")]);
return redirect()->to('/login/forgot_password');
}else{
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_error_email")]);
return redirect()->to('/login/forgot_password');
}
}else{
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_error_pass")]);
return redirect()->to('/login/forgot_password');
}
}
public function setLog($level,$event,$user='')
{
$request = \Config\Services::request();
$ip = $request->getIPAddress();
$agent = $request->getUserAgent();
if ($agent->isBrowser())
{
$currentAgent = $agent->getBrowser().' '.$agent->getVersion();
}
elseif ($agent->isRobot())
{
$currentAgent = $this->agent->robot();
}
elseif ($agent->isMobile())
{
$currentAgent = $agent->getMobile();
}
else
{
$currentAgent = 'Unidentified User Agent';
}
$this->activity_model->save([
'user' => $this->token_user??$user,
'level' => $level,
'event' => $event,
'ip' => $ip,
'os' => $agent->getPlatform(),
'browser' => $currentAgent,
'detail' => $agent
]);
}
private function sendMail($subject,$body,$recipient)
{
$config = $this->settings_model->first();
$gateway = $config['email_gateway'];
$body = html_entity_decode($body);
if($gateway == 'smtp'){
try {
//https://codeigniter.com/user_guide/libraries/email.html
$email = \Config\Services::email();
$config['protocol'] = $config['email_gateway'];
$config['SMTPHost'] = $config['email_smtp'];
$config['SMTPUser'] = $config['email_address'];
$config['SMTPPass'] = $config['email_pass'];
$config['SMTPPort'] = $config['email_port'];
$config['SMTPCrypto'] = $config['email_cert']=='none'?'':$config['email_cert'];
$config['SMTPTimeout'] = 15;
$config['mailType'] = 'html';
$config['wordWrap'] = true;
$email->initialize($config);
$email->setFrom($config['email_address'], $config['email_name']);
$email->setTo($recipient);
$email->setSubject($subject);
$email->setMessage($body);
if (!$email->send())
{
return false;
}else{
return true;
}
} catch (\Exception $ex) {
return false;
}
}
return false;
}
public function saveStorage($file=null,$path='',$allow=[]){
$config = $this->settings_model->first();
$gateway = $config['storage_gateway'];
switch ($gateway) {
case "local":
try {
$ext = $file ? $file->getExtension() : '';
if (in_array(strtolower($ext), $allow)) {
if(strtolower(PHP_OS) == 'linux'){
$pathServer = $path;
}else{
$pathServer = str_replace('/','\\',$path);
}
if ($file->isValid()) {
$name = $file->getName();
$rename = $file->getRandomName();
$file->move($pathServer,$rename);
return $path.$rename;
}
}
return null;
} catch (\Exception $ex) {
return null;
}
case "aws":
case "minio":
$aws_endpoint = $config['aws_endpoint'];
$aws_key = $config['aws_key'];
$aws_secret = $config['aws_secret'];
$aws_region = $config['aws_region'];
$aws_bucket = $config['aws_bucket'];
try {
$ext = $file ? $file->getExtension() : '';
if (in_array(strtolower($ext), $allow)) {
if($gateway=="minio"){
$s3Client = new \Aws\S3\S3Client([
'version' => 'latest',
'region' => $aws_region,
'endpoint' => $aws_endpoint,
'use_path_style_endpoint' => true,
'credentials' => [
'key' => $aws_key,
'secret' => $aws_secret
]
]);
}else{
$s3Client = new \Aws\S3\S3Client([
'version' => 'latest',
'region' => $aws_region,
'credentials' => [
'key' => $aws_key,
'secret' => $aws_secret
]
]);
}
try {
$rename = $file->getRandomName();
$file->move(WRITEPATH.'uploads',$rename);
if(strtolower(PHP_OS) == 'linux'){
$file_Path = WRITEPATH.'uploads/'. $rename;
}else{
$file_Path = WRITEPATH.'uploads\\'. $rename;
}
$result = $s3Client->putObject([
'Bucket' => $aws_bucket,
'Key' => $rename,
'Body' => fopen($file_Path, 'r')
]);
unlink($file_Path);
if($result['@metadata']['statusCode'] == 200){
return $result['@metadata']['effectiveUri'];
}else{
return null;
}
} catch (\Aws\S3\Exception\S3Exception $e) {
return null;
}
}
return null;
} catch (\Exception $ex) {
return null;
}
default:
return null;
}
}
public function saveStorageBackup($file=null,$name=null){
$config = $this->settings_model->first();
$gateway = $config['backup_storage'];
switch ($gateway) {
case "local":
try {
return $file;
} catch (\Exception $ex) {
return null;
}
case "aws":
case "minio":
$aws_endpoint = $config['aws_endpoint'];
$aws_key = $config['aws_key'];
$aws_secret = $config['aws_secret'];
$aws_region = $config['aws_region'];
$aws_bucket = $config['aws_bucket'];
try {
if($gateway=="minio"){
$s3Client = new \Aws\S3\S3Client([
'version' => 'latest',
'region' => $aws_region,
'endpoint' => $aws_endpoint,
'use_path_style_endpoint' => true,
'credentials' => [
'key' => $aws_key,
'secret' => $aws_secret
]
]);
}else{
$s3Client = new \Aws\S3\S3Client([
'version' => 'latest',
'region' => $aws_region,
'credentials' => [
'key' => $aws_key,
'secret' => $aws_secret
]
]);
}
try {
$result = $s3Client->putObject([
'Bucket' => $aws_bucket,
'Key' => $name,
'Body' => fopen($file, 'r')
]);
unlink($file);
if($result['@metadata']['statusCode'] == 200){
return $result['@metadata']['effectiveUri'];
}else{
return null;
}
} catch (\Aws\S3\Exception\S3Exception $e) {
return null;
}
} catch (\Exception $ex) {
return null;
}
default:
return null;
}
}
public function create_backup($download=false)
{
//Demo Mode
if(env('demo.mode')??false){
if($download==true){
session()->setFlashdata('sweet', ['warning',lang("App.general_demo_mode")]);
return redirect()->to('/settings');
}else{
die();
}
}
$settings = $this->settings_model->first()??[];
if($settings['backup_automatic']){
helper('text');
$db = db_connect('default');
try {
$all = false;
$tables = explode(',',$settings['backup_table']??'');
foreach ($tables as $item){
if ($item == 'all'){
$all = true;
}
}
$token = random_string("alnum", 10);
$name ='mysql_'.$token.'_'.date("YmdHis").'.sql';
if(strtolower(PHP_OS) == 'linux'){
$file_Path = WRITEPATH.'uploads/'.$name;
}else{
$file_Path = WRITEPATH.'uploads\\'.$name;
}
if($all){
\Spatie\DbDumper\Databases\MySql::create()
->setHost(getenv('database.default.hostname'))
->setDbName(getenv('database.default.database'))
->setUserName(getenv('database.default.username'))
->setPassword(getenv('database.default.password'))
->setDumpBinaryPath(getenv('database.default.dump'))
->dumpToFile($file_Path);
}else{
\Spatie\DbDumper\Databases\MySql::create()
->setHost(getenv('database.default.hostname'))
->setDbName(getenv('database.default.database'))
->setUserName(getenv('database.default.username'))
->setPassword(getenv('database.default.password'))
->setDumpBinaryPath(getenv('database.default.dump'))
->includeTables($tables)
->dumpToFile($file_Path);
}
$file = $this->saveStorageBackup($file_Path,$name);
$db->query("INSERT INTO backup VALUES (NULL,'".$file."','',NOW(),NOW())");
if($settings['backup_notification_email']){
$send = $this->send_email($settings['backup_email'],$settings['title']." (BACKUP)",lang("App.crontab_backup_success").date("Y-m-d H:i:s"));
if(!$send){
$db->query("INSERT INTO backup VALUES (NULL,'','".lang("App.crontab_email_error")."',NOW(),NOW())");
}
}
if($download){
$this->download_backup($file,$name);
}
} catch (\Spatie\DbDumper\Exceptions\DumpFailed $e) {
$error = str_replace("'","\'",$e->getMessage());
$db->query("INSERT INTO backup VALUES (NULL,'','".$error."',NOW(),NOW())");
if($settings['backup_notification_email']){
$send = $this->send_email($settings['backup_email'],$settings['title']." (BACKUP ERROR)",'Error: '.$e->getMessage());
if(!$send){
$db->query("INSERT INTO backup VALUES (NULL,'','".lang("App.crontab_email_error")."',NOW(),NOW())");
}
}
if($download){
session()->setFlashdata('sweet', ['error',lang("App.crontab_backup_error")]);
return redirect()->to('/settings');
}
}
}
}
private function download_backup($path=null,$name=null)
{
if (!empty(session()->get('token')??'')){
set_time_limit(0);
if(!empty($path) && !empty($name) && file_exists($path)){
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename="'.$name.'"');
header('Content-Type: application/octet-stream');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($path));
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Expires: 0');
readfile($path);
}
}else{
return redirect()->to('/settings');
}
}
public function download_postman()
{
if(!empty(session()->get('token')??'')){
set_time_limit(0);
$path = WRITEPATH.'postman_collection.json';
if(file_exists($path)){
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename="WebGuard ApiRest - postman_collection.json"');
header('Content-Type: application/octet-stream');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($path));
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Expires: 0');
readfile($path);
}
}else{
return redirect()->to('/settings');
}
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
class Language extends BaseController
{
public function index()
{
$session = session();
$locale = $this->request->getLocale();
$session->remove('lang');
$session->set('lang', $locale);
$url = base_url();
return redirect()->to($url);
}
}

View File

@ -0,0 +1,560 @@
<?php
namespace App\Controllers;
use App\Libraries\Authenticator;
use App\Libraries\PasswordHash;
use App\Models\ActivityModel;
use App\Models\ConfirmationTokenModel;
use App\Models\NotificationModel;
use App\Models\PasswordRecoveryModel;
use App\Models\SettingsModel;
use App\Models\TemplateModel;
use App\Models\UserModel;
use App\Models\UserGroupModel;
class login extends BaseController
{
private $user_model;
private $group_model;
private $settings_model;
private $pass_recovery_model;
private $activity_model;
private $notification_model;
private $template_model;
private $confirmation_model;
private $integration;
function __construct()
{
$this->user_model = new UserModel();
$this->group_model = new UserGroupModel();
$this->settings_model = new SettingsModel();
$this->pass_recovery_model = new PasswordRecoveryModel();
$this->activity_model = new ActivityModel();
$this->notification_model = new NotificationModel();
$this->template_model = new TemplateModel();
$this->confirmation_model = new ConfirmationTokenModel();
$this->integration = new Integration();
// Get Settings
$loginAuthFilter = new \App\Filters\LoginAuthFilter();
$loginAuthFilter->getSettings();
}
public function index()
{
$session = session();
$data['settings'] = $session->get('settings');
$header['title'] = lang("App.login_title");
echo view(getenv('theme.path').'login/header',$header);
echo view(getenv('theme.path').'form/login/index',$data);
echo view(getenv('theme.path').'login/footer');
}
public function forgot_password()
{
$session = session();
if($session->get('settings')['forgot_password']??false){
$data['settings'] = $session->get('settings');
$header['title'] = lang("App.login_title_forgot_password");
echo view(getenv('theme.path').'login/header',$header);
echo view(getenv('theme.path').'form/login/forgot_password',$data);
echo view(getenv('theme.path').'login/footer');
}else{
return redirect()->to('/login');
}
}
public function authenticate()
{
$session = session();
$settings = $session->get('settings');
if(!empty($session->get('oauth'))){
// Data obtained by oAuth
$login = $this->user_model->where('email', $session->get('oauth')->email)->first();
} else {
// Data obtained by Form
$getVar = $this->request->getvar();
$login = $this->user_model->where('email', $getVar['email']??'')->first();
// Captcha Validation
if($settings['captcha_login']??false){
if($settings['captcha_gateway'] == 'recaptcha'){
if(isset($getVar['g-recaptcha-response'])){
$captcha = $getVar['g-recaptcha-response'];
$url = 'https://www.google.com/recaptcha/api/siteverify?secret='.urlencode($settings['captcha_secret_key']??'').'&response='.urlencode($captcha);
$response = file_get_contents($url);
$responseKeys = json_decode($response,true);
if(!$responseKeys["success"]) {
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_captcha_invalid")]);
return redirect()->to('login');
}
}else{
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_captcha_not_found")]);
return redirect()->to('login');
}
}
if($settings['captcha_gateway'] == 'hcaptcha'){
if(isset($getVar['h-captcha-response'])){
$captcha = $getVar['h-captcha-response'];
$url = 'https://hcaptcha.com/siteverify?secret='.urlencode($settings['captcha_secret_key']??'').'&response='.urlencode($captcha).'&remoteip='.$_SERVER['REMOTE_ADDR'];
$response = file_get_contents($url);
$responseKeys = json_decode($response,true);
if(!$responseKeys["success"]) {
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_captcha_invalid")]);
return redirect()->to('login');
}
}else{
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_captcha_not_found")]);
return redirect()->to('login');
}
}
}
// Remember Me Validation
if($settings['remember_me']??false){
if($getVar['remember']??'' == 'on') {
$params = session_get_cookie_params();
setcookie(session_name(), $_COOKIE[session_name()], time() + 60*60*24*30, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
}
}
}
if(!empty($login))
{
// Blocked Validation
if($login['blocked']!=null){
$dateBlocked = date($login['blocked']);
$dateNow = date('Y-m-d H:i:s');
if($dateBlocked > $dateNow){
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_user_blocked").$settings['throttle_auth_lockour_time'].' '.lang("App.global_hours")]);
return redirect()->to('login');
}else{
$this->user_model->save([
'id_user' => $login['id_user'],
'blocked' => null
]);
}
}
// Get Ip Address
$request = \Config\Services::request();
$last_ip = $request->getIPAddress();
if(empty($session->get('oauth'))){
// Check user password
$phpass = new PasswordHash(8, true);
if(!$phpass->CheckPassword($getVar['password']??'', $login['password'])){
// Throttling Validation
if($settings['throttle_auth']??false){
$initialDate = date('Y-m-d H:i:s', strtotime('-12 hour', time()));
$finalDate = date('Y-m-d H:i:s');
$amount = $this->activity_model->where('user',$login['token'])->where('level','throttling')->where('created_at between \''.$initialDate.'\' and \''.$finalDate.'\'')->countAllResults();
if($amount >= intval($settings['throttle_auth_max_attempts']??'')){
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_user_blocked").$settings['throttle_auth_lockour_time'].' '.lang("App.global_hours")]);
$blocked = date('Y-m-d H:i:s', strtotime('+'.$settings['throttle_auth_lockour_time'].' hour', time()));
$this->user_model->save([
'id_user' => $login['id_user'],
'blocked' => $blocked
]);
return redirect()->to('login');
}else{
// Register Throttling Log
$this->integration->setLog('throttling','login-authenticate',$login['token']);
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_pass_invalid_2"). ($amount+1) .lang("App.login_alert_pass_attempt"). $settings['throttle_auth_max_attempts']??0]);
return redirect()->to('login');
}
}
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_pass_invalid")]);
return redirect()->to('login');
}
// Check email confirmed
if($settings['email_confirmation']??false){
if(!$login['email_confirmed']){
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.user_alert_email_confirmed")]);
return redirect()->to('login');
}
}
}
// Check user status
if(!$login['status']){
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_disabled_access")]);
return redirect()->to('/login');
}
// Get access rules
$rules = $this->group_model->where('token', $login['group'])->first();
// Save data in session
$session->set('id_user', $login['id_user']);
$session->set('group', $login['group']);
$session->set('first_name', $login['first_name']);
$session->set('last_name', $login['last_name']);
$session->set('email', $login['email']);
$session->set('token', $login['token']);
$session->set('dashboard', $rules['dashboard']);
$session->set('rules', html_entity_decode($rules['rules']));
$session->set('picture', $login['picture']);
$session->set('tfa', $login['tfa']);
$session->set('tfa_secret', $login['tfa_secret']);
$session->set('tfa_code', $login['tfa_code']);
$session->set('lang', $login['language'] ?? 'en');
// Update last access
$last_access = date('Y-m-d H:i:s');
$this->user_model->set('last_access', $last_access)->set('last_ip', $last_ip)->where('id_user', $session->get('id_user'))->update();
// Register Access Log
$integration = new \App\Controllers\Integration;
$integration->setLog('information','login-authenticate');
// Check if it has two factors
if($login['tfa']??false){
return redirect()->to('/login/authentication');
}else{
return redirect()->to('home');
}
}
else
{
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_user_not_found")]);
return redirect()->to('login');
}
}
public function logout()
{
// Destroy the session
$session = session();
$lang = $session->get('lang');
$session->destroy();
return redirect()->to('/lang/'.$lang);
}
public function signup()
{
$session = session();
helper('form');
$data['settings'] = $session->get('settings');
$header['title'] = lang("App.login_title_signup");
echo view(getenv('theme.path').'login/header',$header);
echo view(getenv('theme.path').'form/login/signup',$data);
echo view(getenv('theme.path').'login/footer');
}
public function authentication()
{
$session = session();
if($session->get('tfa')??false){
$header['title'] = lang("App.login_title_otp");
echo view(getenv('theme.path').'login/header',$header);
echo view(getenv('theme.path').'form/login/authentication');
echo view(getenv('theme.path').'login/footer');
}else{
return redirect()->to('/login');
}
}
public function otp()
{
$session = session();
$tfa_secret = $session->get('tfa_secret');
$tfa_code = $session->get('tfa_code');
$pin = $this->request->getVar();
$otp = "";
foreach ($pin as $key=>$value){
if(strpos($key, 'pin') !== false){
$otp .= $value;
}
}
$tfa = new Authenticator();
$backup_pass = false;
$checkResult = $tfa->verify($tfa_secret??'', $otp);
if($tfa_code??'') {
$backup_codes = explode(',' , $tfa_code??'');
if (in_array($otp, $backup_codes)) {
$backup_pass = true;
$key = array_search($otp, $backup_codes);
unset($backup_codes[$key]);
}
}
if($checkResult || $backup_pass == true) {
$session->set('tfa',false);
$session->set('tfa_secret','');
$session->set('tfa_code','');
return redirect()->to('/home');
} else {
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_code_invalid")]);
return redirect()->to('/login/authentication');
}
}
public function store()
{
$session = session();
$settings = $session->get('settings');
helper('form');
helper('text');
$rules = [
'first_name' => 'required',
'last_name' => 'required',
'email' => 'required|valid_email|is_unique[user.email]',
'password' => 'required|min_length[8]'
];
$rules_error = [
'first_name' => [
'required' => lang("App.login_rules_first_name_r")
],
'last_name' => [
'required' => lang("App.login_rules_last_name_r")
],
'email' => [
'required' => lang("App.login_rules_email_r"),
'is_unique' => lang("App.login_rules_email_i"),
'valid_email' => lang("App.login_rules_email_v"),
],
'password' => [
'required' => lang("App.login_rules_password_r"),
'min_length' => lang("App.login_rules_password_m")
]
];
if ($this->validate($rules,$rules_error)){
if($listPost = $this->request->getPost()) {
if($settings['captcha_register']??false){
if($settings['captcha_gateway'] == 'recaptcha'){
if(isset($listPost['g-recaptcha-response'])){
$captcha = $listPost['g-recaptcha-response'];
$url = 'https://www.google.com/recaptcha/api/siteverify?secret='.urlencode($settings['captcha_secret_key']??'').'&response='.urlencode($captcha);
$response = file_get_contents($url);
$responseKeys = json_decode($response,true);
if(!$responseKeys["success"]) {
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_captcha_invalid")]);
$this->signup();
die();
}
}else{
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_captcha_not_found")]);
$this->signup();
die();
}
}
if($settings['captcha_gateway'] == 'hcaptcha'){
if(isset($listPost['h-captcha-response'])){
$captcha = $listPost['h-captcha-response'];
$url = 'https://hcaptcha.com/siteverify?secret='.urlencode($settings['captcha_secret_key']??'').'&response='.urlencode($captcha).'&remoteip='.$_SERVER['REMOTE_ADDR'];
$response = file_get_contents($url);
$responseKeys = json_decode($response,true);
if(!$responseKeys["success"]) {
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_captcha_invalid")]);
$this->signup();
die();
}
}else{
$session->setFlashdata('toast', ['error',lang("App.login_alert"),lang("App.login_alert_captcha_not_found")]);
$this->signup();
die();
}
}
}
$phpass = new PasswordHash(8, true);
$userToken = md5(uniqid(rand(), true));
$this->user_model->save([
'group' => $settings['default_role'],
'first_name' => $listPost['first_name'],
'last_name' => $listPost['last_name'],
'mobile' => '',
'picture' => '/assets/img/default-user.png',
'email' => $listPost['email'],
'password' => $phpass->HashPassword($listPost['password']),
'last_access' => date('Y-m-d h:i:s'),
'last_ip' => '::1',
'language' => $settings['default_language'],
'token' => $userToken,
'status' => true
]);
//Get Data Template
$templates = $this->template_model->findAll();
//Notification E-mail User Welcome
if($settings['send_email_welcome']??false){
$template = templateSelect($templates,'template_label_welcome','email');
if($template != null){
try {
$this->integration->send_email($listPost['email'],$template['subject'],$template['body'],$phpass->HashPassword(MD5($listPost['email'])));
}catch (\Exception $e){
}
}
}
//E-mail Account Confirmation
if($settings['email_confirmation']??false){
$template = templateSelect($templates,'template_label_confirmation_email','email');
if($template != null){
$token = random_string("alnum", 50);
$url = base_url().'/login/confirmation/'.$token;
$body = str_replace('[link_confirmation]',$url,$template['body']);
try {
$this->integration->send_email($listPost['email'],$template['subject'],$body,$phpass->HashPassword(MD5($listPost['email'])));
$this->confirmation_model->save([
'id_confirmation' => null,
'user' => $userToken,
'token' => $token,
'confirmed' => false,
'type' => 'email'
]);
}catch (\Exception $e){
}
}
}
//Notification New Register
if($settings['send_notification_register']??false){
$template = templateSelect($templates,'template_label_notification','email');
if($template != null){
if(!empty($settings['send_user_register']??null)){
$data = [
'id_notification' => null,
'user_sender' => $settings['send_user_register']??null,
'user_recipient' => $settings['send_user_register']??null,
'title' => $template['subject'],
'body' => $template['body'],
'is_read' => false,
'is_send_email' => false,
'send_email_notification' => $settings['send_email_register']??false,
'token' => md5(uniqid(rand(), true))
];
$this->notification_model->save($data);
}
}
}else{
$userAdm = $this->user_model->where('token',$settings['send_user_register']??null)->first();
if($settings['send_email_register']??false){
$template = templateSelect($templates,'template_label_notification','email');
if($template != null){
try {
$this->integration->send_email($userAdm['email'],$template['subject'],$template['body'],$phpass->HashPassword(MD5($listPost['email'])));
}catch (\Exception $e){
}
}
}
}
$session = session();
$session->setFlashdata('toast', ['success', lang("App.login_alert_success"), lang("App.login_alert_success_register")]);
return redirect()->to('/login');
}else{
$session->setFlashdata('toast', ['error', lang("App.login_alert"),lang("App.login_alert_parameter_invalid")]);
$this->signup();
}
}else{
$session = session();
$session->setFlashdata('error','error');
$this->signup();
}
}
public function recovery($token=null)
{
$session = session();
if(!empty($token) && $session->get('settings')['forgot_password']??false){
$pass_recovery = $this->pass_recovery_model->where('token',$token)->where('changed',false)->first();
if($pass_recovery != null){
$data['token'] = $token;
$data['user'] = $pass_recovery['user'];
$header['title'] = lang("App.login_title_recovery");
echo view(getenv('theme.path').'login/header',$header);
echo view(getenv('theme.path').'form/login/password_recovery',$data);
echo view(getenv('theme.path').'login/footer');
}else{
$session->setFlashdata('toast', ['error', lang("App.login_alert"), lang("App.login_alert_invalid_token")]);
return redirect()->to('/login');
}
}else{
$session->setFlashdata('toast', ['error', lang("App.login_alert"), lang("App.login_alert_empty_token")]);
return redirect()->to('/login');
}
}
public function recovery_store()
{
$session = session();
helper('form');
$rules = [
'password' => 'required|min_length[8]'
];
$rules_error = [
'password' => [
'required' => lang("App.login_rules_password_r"),
'min_length' => lang("App.login_rules_password_m")
]
];
if ($this->validate($rules,$rules_error)){
if($listPost = $this->request->getPost()) {
$pass_recovery = $this->pass_recovery_model->where('user',$listPost['user'])->where('token',$listPost['token'])->where('changed',false)->first();
if($pass_recovery != null){
$user = $this->user_model->select('id_user')->where('token',$listPost['user'])->first();
if($user != null){
$phpass = new PasswordHash(8, true);
$this->user_model->save([
'id_user' => $user['id_user'],
'password' => $phpass->HashPassword($listPost['password'])
]);
$this->pass_recovery_model->save([
'id_pass_recovery' => $pass_recovery['id_pass_recovery'],
'changed' => true
]);
$session->setFlashdata('toast', ['success', lang("App.login_alert_success"), lang("App.login_alert_success_recovery")]);
}
}
return redirect()->to('/login');
}else{
$session->setFlashdata('toast', ['error', lang("App.login_alert"), lang("App.login_alert_parameter_invalid")]);
$this->recovery($this->request->getVar('token'));
}
}else{
$session->setFlashdata('error','error');
$this->recovery($this->request->getVar('token'));
}
}
public function confirmation($token=null)
{
$session = session();
if(!empty($token)){
$confirmation = $this->confirmation_model->where('token',$token)->where('confirmed',false)->first();
if($confirmation != null){
$user = $this->user_model->select('id_user')->where('token',$confirmation['user'])->first();
if($confirmation['type'] == 'email'){
$this->user_model->save([
'id_user'=>$user['id_user'],
'email_confirmed'=>true
]);
}
$this->confirmation_model->save([
'id_confirmation'=>$confirmation['id_confirmation'],
'confirmed'=>true
]);
$session->setFlashdata('toast', ['success', lang("App.login_alert_success"), lang("App.login_alert_success_confirmation")]);
return redirect()->to('/login');
}else{
$session->setFlashdata('toast', ['error', lang("App.login_alert"), lang("App.login_alert_invalid_token")]);
return redirect()->to('/login');
}
}else{
$session->setFlashdata('toast', ['error', lang("App.login_alert"), lang("App.login_alert_empty_token")]);
return redirect()->to('/login');
}
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Controllers;
use CodeIgniter\Controller;
use Throwable;
class Migrate extends Controller
{
public function index()
{
$migrate = \Config\Services::migrations();
try {
#$migrate->regress(-1);
$migrate->latest();
echo "migrated";
} catch (\Exception $e) {
echo $e->getMessage();
}
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace App\Controllers;
use App\Models\NotificationModel;
use App\Models\UserModel;
class My extends BaseController
{
private $user_model;
private $notification_model;
function __construct()
{
$this->user_model = new UserModel();
$this->notification_model = new NotificationModel();
}
public function index()
{
return redirect()->to('profile');
}
public function notification()
{
$session = session();
$data['title'] = [
'module' => lang("App.notification_title_my"),
'page' => lang("App.notification_subtitle_my"),
'icon' => 'fas fa-bell'
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.notification_title_my"), 'route' => "", 'active' => true]
];
$data['btn_add'] = [
'title' => lang("App.notification_btn_add"),
'route' => '/notification/add',
'class' => 'btn btn-lg btn-primary float-md-right',
'icon' => 'fas fa-plus'
];
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/my/notification',$data);
echo view(getenv('theme.path').'main/footer');
}
public function notification_view($id)
{
$session = session();
$data['obj'] = $this->notification_model->where('token', $id)->first();
if($data['obj']==null){
return redirect()->to('/my/notification');
}else{
if(!$data['obj']['is_read']){
$this->notification_model->save(['id_notification' => $data['obj']['id_notification'],'is_read' => true]);
$notification = $session->get('notification')??[];
foreach ($notification as $key => $value){
if($notification[$key]['token'] == $id){
$notification[$key]['is_read'] = '1';
}
}
$pulse = $this->notification_model->where('user_recipient',$session->get('token'))->where('is_read',false)->countAllResults() ?? 0;
$session->set('pulse', $pulse);
$session->set('notification',$notification);
}
}
$data['title'] = [
'module' => lang("App.notification_title_my"),
'page' => lang("App.notification_subtitle_view"),
'icon' => 'far fa-envelope-open'
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.notification_title_my"), 'route' => "/my/notification", 'active' => false],
['title' => lang("App.notification_subtitle_view"), 'route' => "", 'active' => true]
];
$data['btn_return'] = [
'title' => lang("App.global_come_back"),
'route' => '/my/notification',
'class' => 'btn btn-dark mr-1',
'icon' => 'fas fa-angle-left'
];
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/my/view',$data);
echo view(getenv('theme.path').'main/footer');
}
}

View File

@ -0,0 +1,190 @@
<?php
namespace App\Controllers;
use App\Models\CountriesModel;
use App\Models\UserModel;
use App\Models\NotificationModel;
class Notification extends BaseController
{
private $user_model;
private $countries_model;
private $id_user;
private $token_user;
private $notification_model;
function __construct()
{
$this->user_model = new UserModel();
$this->countries_model = new CountriesModel();
$this->id_user = session()->get('id_user');
$this->token_user = session()->get('token');
$this->notification_model = new NotificationModel();
}
public function index()
{
$data['title'] = [
'module' => lang("App.notification_title"),
'page' => lang("App.notification_subtitle"),
'icon' => 'fas fa-bell'
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.notification_title"), 'route' => "", 'active' => true]
];
$data['btn_add'] = [
'title' => lang("App.notification_btn_add"),
'route' => '/notification/add',
'class' => 'btn btn-lg btn-primary float-md-right',
'icon' => 'fas fa-plus'
];
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/notification/index',$data);
echo view(getenv('theme.path').'main/footer');
}
public function add()
{
helper('form');
$data['title'] = [
'module' => lang("App.notification_add_title"),
'page' => lang("App.notification_add_subtitle"),
'icon' => 'far fa-plus-square'
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.notification_title"), 'route' => "/user", 'active' => false],
['title' => lang("App.notification_add_title"), 'route' => "", 'active' => true]
];
$data['btn_return'] = [
'title' => lang("App.global_come_back"),
'route' => '/notification',
'class' => 'btn btn-dark mr-1',
'icon' => 'fas fa-angle-left'
];
$data['btn_submit'] = [
'title' => lang("App.global_save"),
'route' => '',
'class' => 'btn btn-primary mr-1',
'icon' => 'fas fa-save'
];
$data['user'] = $this->user_model->where('status',true)->findAll();
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/notification/form',$data);
echo view(getenv('theme.path').'main/footer');
}
public function store()
{
//Demo Mode
if(env('demo.mode')??false){
session()->setFlashdata('sweet', ['warning',lang("App.general_demo_mode")]);
return redirect()->to('/notification');
}
$session = session();
helper('form');
$rules = [
'title' => 'required',
'body' => 'required'
];
$rules_error = [
'title' => [
'required' => lang("App.notification_rules_title_r"),
],
'body' => [
'required' => lang("App.notification_rules_body_r"),
]
];
if ($this->validate($rules,$rules_error)){
if($listPost = $this->request->getPost()){
$listPost['send_email_notification'] = isset($listPost['send_email_notification']) && $listPost['send_email_notification'] == 'on';
if(!empty($listPost['user_recipient'])){
$user = $this->user_model->where('token',$session->get('token'))->first();
foreach (keywordEmail()??[] as $item){
$field = str_replace(['[','user_',']'],'',$item);
$listPost['title'] = str_replace('['.$item.']',$user[$field],$listPost['title']);
$listPost['body'] = str_replace('['.$item.']',$user[$field],$listPost['body']);
}
$listPost['token'] = md5(uniqid(rand(), true));
$listPost['user_sender'] = $session->get('token');
$this->notification_model->save($listPost);
}else{
$users = $this->user_model->where('status',true)->findAll();
$data = [];
foreach ($users as $user){
$title = $listPost['title'];
$template = $listPost['body'];
foreach (keywordEmail()??[] as $item){
$field = str_replace(['[','user_',']'],'',$item);
$title = str_replace('['.$item.']',$user[$field],$title);
$template = str_replace('['.$item.']',$user[$field],$template);
}
array_push($data,[
'id_notification' => null,
'user_sender' => $session->get('token'),
'user_recipient' => $user['token'],
'title' => $title,
'body' => $template,
'is_read' => false,
'is_send_email' => false,
'send_email_notification' => $listPost['send_email_notification'],
'token' => md5(uniqid(rand(), true)),
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s')
]);
}
if(count($data)>0){
$this->notification_model->insertBatch($data);
}
}
if(empty($this->request->getPost('id_notification'))){
$session->setFlashdata('sweet', ['success',lang("App.notification_alert_add")]);
return redirect()->to('/notification');
}else{
$session->setFlashdata('sweet', ['success',lang("App.notification_alert_edit")]);
return redirect()->to('/notification');
}
}
}else{
$session->setFlashdata('error','error');
$this->add();
}
}
public function delete($token)
{
//Demo Mode
if(env('demo.mode')??false){
session()->setFlashdata('sweet', ['warning',lang("App.general_demo_mode")]);
return redirect()->to('/notification');
}
$session = session();
if(!empty($session->get('token'))){
$this->notification_model->where('token', $token)->delete();
$session->setFlashdata('sweet', ['success',lang("App.notification_alert_delete")]);
return redirect()->to('/notification');
}else{
return redirect()->to('/login');
}
}
}

View File

@ -0,0 +1,194 @@
<?php
namespace App\Controllers;
use App\Libraries\PasswordHash;
use App\Models\CountriesModel;
use App\Models\UserGroupModel;
use App\Models\UserModel;
class Profile extends BaseController
{
private $user_model;
private $countries_model;
private $id_user;
private $token_user;
function __construct()
{
$this->user_model = new UserModel();
$this->countries_model = new CountriesModel();
$this->id_user = session()->get('id_user');
$this->token_user = session()->get('token');
}
public function index()
{
helper('file');
helper('form');
helper('text');
$data['title'] = [
'module' => lang("App.profile_title"),
'page' => lang("App.profile_subtitle"),
'icon' => 'fas fa-user'
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.profile_title"), 'route' => "", 'active' => true]
];
$data['btn_return'] = [
'title' => lang("App.global_come_back"),
'route' => '/',
'class' => 'btn btn-dark mr-1',
'icon' => 'fas fa-angle-left'
];
$data['btn_submit'] = [
'title' => lang("App.global_save"),
'route' => '',
'class' => 'btn btn-primary mr-1',
'icon' => 'fas fa-save'
];
$session = session();
$data['obj'] = $this->user_model->where('id_user',$this->id_user)->first();
if(!empty($data['obj']['date_birth'])){
$data['obj']['date_birth'] = dateFormatWeb($data['obj']['date_birth']);
}
$data['country'] = $this->countries_model->select('code,name')->where('data_lang',session()->get('lang')??'en')->findAll();
$file = $this->request->getFile('file');
if(!empty($file)){
$integration = new Integration();
$allow = ['jpeg','jpg','gif','bmp','png'];
$path = 'assets/img/';
$pathRet = '/'.$integration->saveStorage($file,$path,$allow);
if(!empty($pathRet)){
$this->user_model->save([
'id_user' => $this->id_user,
'picture' => $pathRet
]);
$data['obj']['picture'] = $pathRet;
$session->set('picture',$pathRet);
}
}else{
if(!empty($this->request->getPost())){
$post = $this->request->getPost();
$image = '';
foreach ($post as $key=>$value){
if(strpos($key, 'image') !== false){
$image = $value;
}
}
if(!empty($image)){
$this->user_model->save([
'id_user' => $this->id_user,
'picture' => $image
]);
$data['obj']['picture'] = $image;
$session->set('picture',$image);
}
}
}
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/profile/index', $data);
echo view(getenv('theme.path').'main/footer');
}
public function store()
{
//Demo Mode
if(env('demo.mode')??false){
session()->setFlashdata('sweet', ['warning',lang("App.general_demo_mode")]);
return redirect()->to('/profile');
}
$session = session();
helper('form');
$password = 'max_length[35]';
$confirm_password = 'max_length[35]';
if(!empty($this->request->getPost('password'))){
$password = 'required|min_length[8]';
$confirm_password = 'matches[password]';
}
$rules = [
'first_name' => 'required',
'last_name' => 'required',
'password' => $password,
'confirm_password' => $confirm_password
];
$rules_error = [
'first_name' => ['required' => lang("App.profile_rules_first_name_r")],
'last_name' => ['required' => lang("App.profile_rules_last_name_r")],
'password' => [
'required' => lang("App.profile_rules_password_r"),
'min_length' => lang("App.profile_rules_password_m")
],
'confirm_password' => ['matches' => lang("App.profile_rules_password_confirm_m")]
];
if(empty($this->request->getPost('tfa_secret'))){
if ($this->validate($rules??[],$rules_error??[])){
if(!empty($this->id_user)){
$date_birth = !empty($this->request->getPost('date_birth')??'') ? dateFormatMysql($this->request->getPost('date_birth')):null;
$this->user_model->save([
'id_user' => $this->id_user,
'first_name' => $this->request->getPost('first_name'),
'last_name' => $this->request->getPost('last_name'),
'date_birth' => $date_birth,
'address' => $this->request->getPost('address'),
'city' => $this->request->getPost('city'),
'state' => $this->request->getPost('state'),
'country' => $this->request->getPost('country'),
'zip_code' => $this->request->getPost('zip_code'),
'mobile' => $this->request->getPost('mobile'),
'language' => $this->request->getPost('language')
]);
$session->set('lang', $this->request->getPost('language') ?? 'en');
if(!empty($this->request->getPost('password'))){
$phpass = new PasswordHash(8, true);
$this->user_model->save([
'id_user' => $this->id_user,
'password' => $phpass->HashPassword($this->request->getPost('password')),
]);
}
$session->setFlashdata('sweet', ['success',lang("App.global_alert_save_success")]);
}else{
$session->setFlashdata('sweet', ['error',lang("App.global_alert_save_error")]);
}
}else{
$session->setFlashdata('error','error');
return $this->index();
}
}else{
if($this->request->getPost('tfa') == 'on'){
$this->user_model->save([
'id_user' => $this->id_user,
'tfa' => true,
'tfa_secret' => $this->request->getPost('tfa_secret'),
'tfa_code' => $this->request->getPost('tfa_code')
]);
}else{
$this->user_model->save([
'id_user' => $this->id_user,
'tfa' => false,
'tfa_secret' => '',
'tfa_code' => ''
]);
}
$session->setFlashdata('sweet', ['success',lang("App.global_alert_save_success")]);
}
return redirect()->to('/profile');
}
}

View File

@ -0,0 +1,220 @@
<?php
namespace App\Controllers;
use App\Models\CountriesModel;
use App\Models\CronTabModel;
use App\Models\CurrencyModel;
use App\Models\SettingsModel;
use App\Models\TemplateModel;
use App\Models\ThemeModel;
use App\Models\TimezoneModel;
use App\Models\UserGroupModel;
use App\Models\UserModel;
class Settings extends BaseController
{
private $settings_model;
private $countries_model;
private $theme_model;
private $currency_model;
private $timezone_model;
private $group_model;
private $template_model;
private $user_model;
private $crontab_model;
private $integration;
function __construct()
{
$this->settings_model = new SettingsModel();
$this->countries_model = new CountriesModel();
$this->theme_model = new ThemeModel();
$this->currency_model = new CurrencyModel();
$this->timezone_model = new TimezoneModel();
$this->group_model = new UserGroupModel();
$this->template_model = new TemplateModel();
$this->user_model = new UserModel();
$this->crontab_model = new CronTabModel();
$this->integration = new Integration();
}
public function index()
{
helper('form');
$data['title'] = [
'module' => lang("App.settings_title"),
'page' => lang("App.settings_subtitle"),
'icon' => 'fas fa-sliders-h'
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.menu_settings"), 'route' => "", 'active' => true]
];
$data['btn_return'] = [
'title' => lang("App.global_come_back"),
'route' => '/home',
'class' => 'btn btn-dark mr-1',
'icon' => 'fas fa-angle-left'
];
$data['btn_submit'] = [
'title' => lang("App.global_save"),
'route' => '',
'class' => 'btn btn-primary mr-1',
'icon' => 'fas fa-save'
];
$data['obj'] = $this->settings_model->first();
$data['countries'] = $this->countries_model->select('id_country,code,name')->where('data_lang',session()->get('lang')??'en')->findAll();
$data['theme'] = $this->theme_model->select('id_theme,type,name')->findAll();
$data['currency'] = $this->currency_model->select('id_currency,code,name')->findAll();
$data['timezone'] = $this->timezone_model->select('id_timezone,timezone,description')->findAll();
$data['group'] = $this->group_model->select('token,title')->findAll();
$db = db_connect('default');
$data['tables'] = $db->listTables();
$data['user'] = $this->user_model->select('token,first_name,email')->where('status',true)->findAll();
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/settings/index', $data);
echo view(getenv('theme.path').'main/footer');
}
public function store()
{
//Demo Mode
if(env('demo.mode')??false){
session()->setFlashdata('sweet', ['warning',lang("App.general_demo_mode")]);
return redirect()->to('/settings');
}
helper('form');
$session = session();
if($listPost = $this->request->getPost()){
$listPost['id_settings'] = 1;
$listPost['captcha_register'] = isset($listPost['captcha_register']) && $listPost['captcha_register'] == 'on';
$listPost['captcha_login'] = isset($listPost['captcha_login']) && $listPost['captcha_login'] == 'on';
$listPost['captcha_recovery'] = isset($listPost['captcha_recovery']) && $listPost['captcha_recovery'] == 'on';
$listPost['registration'] = isset($listPost['registration']) && $listPost['registration'] == 'on';
$listPost['terms_conditions'] = isset($listPost['terms_conditions']) && $listPost['terms_conditions'] == 'on';
$listPost['email_confirmation'] = isset($listPost['email_confirmation']) && $listPost['email_confirmation'] == 'on';
$listPost['send_email_register'] = isset($listPost['send_email_register']) && $listPost['send_email_register'] == 'on';
$listPost['send_notification_register'] = isset($listPost['send_notification_register']) && $listPost['send_notification_register'] == 'on';
$listPost['send_email_welcome'] = isset($listPost['send_email_welcome']) && $listPost['send_email_welcome'] == 'on';
$listPost['remember_me'] = isset($listPost['remember_me']) && $listPost['remember_me'] == 'on';
$listPost['forgot_password'] = isset($listPost['forgot_password']) && $listPost['forgot_password'] == 'on';
$listPost['two_factor_auth'] = isset($listPost['two_factor_auth']) && $listPost['two_factor_auth'] == 'on';
$listPost['throttle_auth'] = isset($listPost['throttle_auth']) && $listPost['throttle_auth'] == 'on';
$listPost['enable_api'] = isset($listPost['enable_api']) && $listPost['enable_api'] == 'on';
$listPost['block_external_api'] = isset($listPost['block_external_api']) && $listPost['block_external_api'] == 'on';
$listPost['remove_log'] = isset($listPost['remove_log']) && $listPost['remove_log'] == 'on';
$listPost['backup_notification_email'] = isset($listPost['backup_notification_email']) && $listPost['backup_notification_email'] == 'on';
$listPost['backup_automatic'] = isset($listPost['backup_automatic']) && $listPost['backup_automatic'] == 'on';
$listPost['backup_table'] = implode(",",$listPost['backup_table']??[]);
$this->settings_model->save($listPost);
$settings = $this->settings_model->first()??[];
$session->set('settings', $settings);
$session->set('lang', $settings['default_language'] ?? 'en');
$session->setFlashdata('sweet', ['success',lang("App.settings_alert_add")]);
return redirect()->to('/settings');
} else{
$session->setFlashdata('sweet', ['error',lang("App.settings_alert_error")]);
return redirect()->to('/settings');
}
}
public function template()
{
helper('form');
$data['title'] = [
'module' => lang("App.template_title"),
'page' => lang("App.template_subtitle"),
'icon' => 'fas fa-mail-bulk'
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.menu_settings"), 'route' => "/settings", 'active' => false],
['title' => lang("App.template_title"), 'route' => "", 'active' => true]
];
$data['btn_return'] = [
'title' => lang("App.global_come_back"),
'route' => '/home',
'class' => 'btn btn-dark mr-1',
'icon' => 'fas fa-angle-left'
];
$data['btn_submit'] = [
'title' => lang("App.global_save"),
'route' => '',
'class' => 'btn btn-primary mr-1',
'icon' => 'fas fa-save'
];
$data['template'] = $this->template_model->findAll();
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/settings/template', $data);
echo view(getenv('theme.path').'main/footer');
}
public function template_store()
{
//Demo Mode
if(env('demo.mode')??false){
session()->setFlashdata('sweet', ['warning',lang("App.general_demo_mode")]);
return redirect()->to('/settings/template');
}
$session = session();
helper('form');
if($field = $this->request->getPost()){
$ids = [];
$template = [];
unset($field['files']);
foreach ($field as $key=>$value){
$id = explode('_',$key);
array_push($ids,$id[2]);
}
foreach (array_unique($ids) as $item){
$template[$item] = [];
foreach ($field as $key=>$value){
$id = explode('_',$key);
if($id[2] == $item){
if(empty($template[$item])){
$template[$item] = array_merge( $template[$item],['id_template' => intval($id[2])]);
$template[$item] = array_merge( $template[$item],['subject' => ""]);
$template[$item] = array_merge( $template[$item],['body' => ""]);
}
switch($id[1])
{
case 'email';
switch($id[0])
{
case 'title';
$template[$item] = array_merge( $template[$item],['subject' => $value]);
break;
default;
$template[$item] = array_merge( $template[$item],[$id[0] => $value]);
break;
}
break;
}
}
}
}
$this->template_model->updateBatch($template,'id_template');
$session->setFlashdata('sweet', ['success',lang("App.template_alert_add")]);
return redirect()->to('/settings/template');
} else{
$session->setFlashdata('sweet', ['error',lang("App.template_alert_error")]);
return redirect()->to('/settings/template');
}
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Controllers;
class Test extends BaseController
{
function __construct()
{
}
public function index()
{
["id_user"]=>
string(1) "1"
$test = [
"115b5ad39b853084209caf6824224f6b",
"fff26488a4249d76a8de5c0426acb8f7",
"72f5e898a67bb2fb72b185d9138585b2"];
echo "Hola";
}
}

View File

@ -0,0 +1,311 @@
<?php
namespace App\Controllers;
use App\Libraries\PasswordHash;
use App\Models\ActivityModel;
use App\Models\CountriesModel;
use App\Models\UserModel;
use App\Models\UserGroupModel;
use App\Models\GroupUserModel;
class User extends BaseController
{
private $user_model;
private $group_model;
private $group_user_model;
private $countries_model;
private $activity_model;
function __construct()
{
$this->user_model = new UserModel();
$this->group_model = new UserGroupModel();
$this->countries_model = new CountriesModel();
$this->activity_model = new ActivityModel();
$this->group_user_model = new GroupUserModel();
}
public function index()
{
$data['title'] = [
'module' => lang("App.user_title"),
'page' => lang("App.user_subtitle"),
'icon' => 'fas fa-user-friends'
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.user_title"), 'route' => "", 'active' => true]
];
$data['btn_add'] = [
'title' => lang("App.user_btn_add"),
'route' => '/user/add',
'class' => 'btn btn-lg btn-primary float-md-right',
'icon' => 'fas fa-plus'
];
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/user/index',$data);
echo view(getenv('theme.path').'main/footer');
}
public function add()
{
helper('form');
$data['title'] = [
'module' => lang("App.user_add_title"),
'page' => lang("App.user_add_subtitle"),
'icon' => 'far fa-plus-square'
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.user_title"), 'route' => "/user", 'active' => false],
['title' => lang("App.user_add_title"), 'route' => "", 'active' => true]
];
$data['btn_return'] = [
'title' => lang("App.global_come_back"),
'route' => '/user',
'class' => 'btn btn-dark mr-1',
'icon' => 'fas fa-angle-left'
];
$data['btn_submit'] = [
'title' => lang("App.global_save"),
'route' => '',
'class' => 'btn btn-primary mr-1',
'icon' => 'fas fa-save'
];
$data['group'] = $this->group_user_model->select('token,title')->findAll();
$data['country'] = $this->countries_model->select('code,name')->where('data_lang',session()->get('lang')??'en')->findAll();
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/user/form',$data);
echo view(getenv('theme.path').'main/footer');
}
public function edit($token=null)
{
if(empty($token)){
return redirect()->to('/user');
}
helper('form');
$data['title'] = [
'module' => lang("App.user_edit_title"),
'page' => lang("App.user_edit_subtitle"),
'icon' => 'fas fa-edit'
];
$data['breadcrumb'] = [
['title' => lang("App.menu_dashboard"), 'route' => "/home", 'active' => false],
['title' => lang("App.user_title"), 'route' => "/user", 'active' => false],
['title' => lang("App.user_edit_title"), 'route' => "", 'active' => true]
];
$data['btn_return'] = [
'title' => lang("App.global_come_back"),
'route' => '/user',
'class' => 'btn btn-dark mr-1',
'icon' => 'fas fa-angle-left'
];
$data['btn_submit'] = [
'title' => lang("App.global_save"),
'route' => '',
'class' => 'btn btn-primary mr-1',
'icon' => 'fas fa-save'
];
$data['obj'] = $this->user_model->where('token', $token)->first();
if($data['obj']==null){
return redirect()->to('/user');
}
if(!empty($data['obj']['date_birth'])){
$data['obj']['date_birth'] = dateFormatWeb($data['obj']['date_birth']);
}
$data['selected_groups'] = $this->group_user_model->select('token_group')->where('token_user', $token)->findAll();
$data['group'] = $this->group_model->select('token,title')->findAll();
$data['country'] = $this->countries_model->select('code,name')->where('data_lang',session()->get('lang')??'en')->findAll();
echo view(getenv('theme.path').'main/header');
echo view(getenv('theme.path').'form/user/form',$data);
echo view(getenv('theme.path').'main/footer');
}
public function store()
{
//Demo Mode
if(env('demo.mode')??false){
session()->setFlashdata('sweet', ['warning',lang("App.general_demo_mode")]);
return redirect()->to('/user');
}
$session = session();
helper('form');
$password = 'max_length[35]';
$confirm_password = 'max_length[35]';
$email = 'required|valid_email';
if(empty($this->request->getPost('id_user'))){
$email = 'required|valid_email|is_unique[user.email]';
$password = 'required|min_length[8]';
$confirm_password = 'matches[password]';
}else{
if(!empty($this->request->getPost('password'))){
$password = 'required|min_length[8]';
$confirm_password = 'matches[password]';
}
}
$rules = [
'first_name' => 'required',
'last_name' => 'required',
'email' => $email,
'password' => $password,
'confirm_password' => $confirm_password
];
$rules_error = [
'first_name' => [
'required' => lang("App.user_rules_first_name_r"),
],
'last_name' => [
'required' => lang("App.user_rules_last_name_r"),
],
'email' => [
'required' => lang("App.user_rules_email_r"),
'is_unique' => lang("App.user_rules_email_i"),
],
'password' => [
'required' => lang("App.user_rules_password_r"),
'min_length' => lang("App.user_rules_password_m"),
],
'confirm_password' => [
'matches' => lang("App.user_rules_password_confirm_m"),
]
];
if ($this->validate($rules,$rules_error)){
$date_birth = !empty($this->request->getPost('date_birth')??'') ? dateFormatMysql($this->request->getPost('date_birth')):null;
if(empty($this->request->getPost('id_user'))){
$phpass = new PasswordHash(8, true);
$this->user_model->save([
'id_user' => null,
'group' => $this->request->getPost('group'),
'first_name' => $this->request->getPost('first_name'),
'last_name' => $this->request->getPost('last_name'),
'date_birth' => $date_birth,
'address' => $this->request->getPost('address'),
'city' => $this->request->getPost('city'),
'state' => $this->request->getPost('state'),
'country' => $this->request->getPost('country'),
'zip_code' => $this->request->getPost('zip_code'),
'mobile' => $this->request->getPost('mobile'),
'email' => $this->request->getPost('email'),
'password' => $phpass->HashPassword($this->request->getPost('password')),
'last_access' => date('Y-m-d h:i:s'),
'last_ip' => '::1',
'picture' => '/assets/img/default-user.png',
'language' => $this->request->getPost('language'),
'token' => md5(uniqid(rand(), true)),
'status' => $this->request->getPost('status'),
'email_confirmed' => $this->request->getPost('email_confirmed')
]);
}else{
echo "<pre>";
var_dump($this->request->getPost());
echo "</pre>" ;
dd();
$this->user_model->save([
'id_user' => $this->request->getPost('id_user'),
//'group' => $this->request->getPost('group'),
'first_name' => $this->request->getPost('first_name'),
'last_name' => $this->request->getPost('last_name'),
'date_birth' => $date_birth,
'address' => $this->request->getPost('address'),
'city' => $this->request->getPost('city'),
'state' => $this->request->getPost('state'),
'country' => $this->request->getPost('country'),
'zip_code' => $this->request->getPost('zip_code'),
'mobile' => $this->request->getPost('mobile'),
'email' => $this->request->getPost('email'),
'language' => $this->request->getPost('language'),
'status' => $this->request->getPost('status'),
'email_confirmed' => $this->request->getPost('email_confirmed')
]);
if(!empty($this->request->getPost('password'))){
$phpass = new PasswordHash(8, true);
$this->user_model->save([
'id_user' => $this->request->getPost('id_user'),
'password' => $phpass->HashPassword($this->request->getPost('password')),
]);
}
$user_token = $this->user_model
->select('token')
->where('id_user',$this->request->getPost('id_user'))->first();
$this->group_user_model->delete(['user_token' => $user_token]);
$groups = implode(",",$this->request->getPost('group')??[]);
foreach ($groups as $group){
$group_user_data = [
'token_user' => $this->request->getPost('id_user'),
'token_group' => $group
];
$this->group_user_model->insert($group_user_data);
}
}
if(empty($this->request->getPost('id_user'))){
$session->setFlashdata('sweet', ['success',lang("App.user_alert_add")]);
return redirect()->to('/user');
}else{
if($session->get('id_user') == $this->request->getPost('id_user')){
$access_rules = $this->group_model->select('rules')->where('token',$this->request->getPost('group'))->first();
$session->set('rules', html_entity_decode($access_rules['rules']));
}
$session->setFlashdata('sweet', ['success',lang("App.user_alert_edit")]);
return redirect()->to('/user');
}
}else{
$session->setFlashdata('error','error');
$this->add();
}
}
public function delete($token)
{
//Demo Mode
if(env('demo.mode')??false){
session()->setFlashdata('sweet', ['warning',lang("App.general_demo_mode")]);
return redirect()->to('/user');
}
$session = session();
if(!empty($session->get('token'))){
$this->user_model->where('token', $token)->delete();
$this->activity_model->where('user', $token)->delete();
$session->setFlashdata('sweet', ['success',lang("App.user_alert_delete")]);
return redirect()->to('/user');
}else{
return redirect()->to('/login');
}
}
}

View File

View File

@ -0,0 +1,45 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class ChangeTablesNames extends Migration
{
public function up()
{
$this->forge->renameTable('wg_activity', 'auth_activity');
$this->forge->renameTable('wg_backup', 'auth_backup');
$this->forge->renameTable('wg_confirmation_token', 'auth_confirmation_token');
$this->forge->renameTable('wg_crontab_history', 'auth_crontab_history');
$this->forge->renameTable('wg_notification', 'auth_notification');
$this->forge->renameTable('wg_password_recovery', 'auth_password_recovery');
$this->forge->renameTable('wg_settings', 'auth_settings');
$this->forge->renameTable('wg_template', 'auth_template');
$this->forge->renameTable('wg_theme', 'auth_theme');
$this->forge->renameTable('wg_timezone', 'auth_timezone');
$this->forge->renameTable('wg_user', 'auth_user');
$this->forge->renameTable('wg_user_group', 'auth_user_group');
$this->forge->renameTable('wg_user_group', 'auth_user_group');
$this->forge->renameTable('wg_countries', 'auth_countries');
$this->forge->renameTable('wg_currency', 'auth_currency');
}
public function down()
{
$this->forge->renameTable('auth_activity', 'wg_activity');
$this->forge->renameTable('auth_backup', 'wg_backup');
$this->forge->renameTable('auth_confirmation_token', 'wg_confirmation_token');
$this->forge->renameTable('auth_crontab_history', 'wg_crontab_history');
$this->forge->renameTable('wg_notification', 'auth_notification');
$this->forge->renameTable('auth_password_recovery', 'wg_password_recovery');
$this->forge->renameTable('auth_settings', 'wg_settings');
$this->forge->renameTable('auth_template', 'wg_template');
$this->forge->renameTable('auth_theme', 'wg_theme');
$this->forge->renameTable('auth_timezone', 'wg_timezone');
$this->forge->renameTable('auth_user', 'wg_user');
$this->forge->renameTable('auth_user_group', 'wg_user_group');
$this->forge->renameTable('auth_countries', 'wg_countries');
$this->forge->renameTable('auth_currency', 'wg_currency');
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateGroupUserTable extends Migration
{
public function up()
{
// define table fields
$fields = array(
'token_user' => array(
'type' => 'VARCHAR',
'constraint' => 35
),
'token_group' => array(
'type' => 'VARCHAR',
'constraint' => 35
)
);
$this->forge->addField($fields);
// create table
$this->forge->createTable('group_user');
}
public function down()
{
$this->forge->dropTable('group_user',TRUE);
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class DropOauthTables extends Migration
{
public function up()
{
$this->forge->dropTable('wg_user_oauth');
$this->forge->dropTable('wg_settings_oauth');
}
public function down()
{
$sql = "CREATE TABLE IF NOT EXISTS `wg_settings_oauth` (
`id_oauth` int(11) NOT NULL AUTO_INCREMENT,
`provider` enum('facebook','google','twitter','linkedin','github','instagram','slack','spotify','reddit','discord','dribbble','dropbox','gitlab','strava','tumblr','twitch','vkontakte','wordpress','yahoo','bitbucket','wechat') COLLATE latin1_general_ci NOT NULL,
`key` varchar(200) COLLATE latin1_general_ci DEFAULT NULL,
`secret` varchar(200) COLLATE latin1_general_ci DEFAULT NULL,
`btn_class` varchar(50) COLLATE latin1_general_ci NOT NULL,
`btn_text` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
`show_text` tinyint(1) NOT NULL DEFAULT '0',
`icon_class` varchar(50) COLLATE latin1_general_ci NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_oauth`)
) ENGINE=MyISAM AUTO_INCREMENT=22 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";
$this->db->query($sql);
$sql = "CREATE TABLE IF NOT EXISTS `wg_user_oauth` (
`id_user_oauth` int(11) NOT NULL AUTO_INCREMENT,
`user` varchar(35) COLLATE latin1_general_ci NOT NULL,
`provider` enum('facebook','google','twitter','linkedin','github','instagram','slack','spotify','reddit','discord','dribbble','dropbox','gitlab','strava','tumblr','twitch','vkontakte','wordpress','yahoo','bitbucket') COLLATE latin1_general_ci NOT NULL,
`identifier` varchar(50) COLLATE latin1_general_ci NOT NULL,
`picture` varchar(150) COLLATE latin1_general_ci NOT NULL,
`created_at` timestamp NOT NULL,
`updated_at` timestamp NOT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id_user_oauth`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";
$this->db->query($sql);
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class DeleteSMSColumns extends Migration
{
public function up()
{
$this->forge->dropColumn('notification', ['is_send_sms', 'send_sms_notification']);
$this->forge->dropColumn('settings', ['sms_gateway','sms_account_id', 'sms_auth_token', 'sms_info_add',
'sms_confirmation', 'send_sms_register', 'send_sms_welcome']);
$this->forge->dropColumn('user', ['sms_confirmed']);
}
public function down()
{
$sql = "ALTER TABLE `wg_notification` ADD `is_send_sms` tinyint(1) NOT NULL DEFAULT '0';";
$this->db->query($sql);
$sql = "ALTER TABLE `wg_notification` ADD `send_sms_notification` tinyint(1) NOT NULL DEFAULT '0';";
$this->db->query($sql);
$sql = "ALTER TABLE `wg_settings` ADD `sms_gateway` enum('twilio') COLLATE latin1_general_ci NOT NULL DEFAULT 'twilio';";
$this->db->query($sql);
$sql = "ALTER TABLE `wg_settings` ADD `sms_account_id` varchar(255) COLLATE latin1_general_ci DEFAULT NULL;";
$this->db->query($sql);
$sql = "ALTER TABLE `wg_settings` ADD `sms_auth_token` varchar(255) COLLATE latin1_general_ci DEFAULT NULL;";
$this->db->query($sql);
$sql = "ALTER TABLE `wg_settings` ADD `sms_info_add` varchar(255) COLLATE latin1_general_ci DEFAULT NULL;";
$this->db->query($sql);
$sql = "ALTER TABLE `wg_settings` ADD `sms_confirmation` tinyint(1) NOT NULL DEFAULT '0';";
$this->db->query($sql);
$sql = "ALTER TABLE `wg_settings` ADD `send_sms_register` tinyint(1) NOT NULL DEFAULT '0';";
$this->db->query($sql);
$sql = "ALTER TABLE `wg_settings` ADD `send_sms_welcome` tinyint(1) NOT NULL DEFAULT '0';";
$this->db->query($sql);
$sql = "ALTER TABLE `wg_user` ADD `sms_confirmed` tinyint(4) NOT NULL DEFAULT '0';";
$this->db->query($sql);
}
}

View File

0
ci4/app/Filters/.gitkeep Normal file
View File

View File

@ -0,0 +1,28 @@
<?php
namespace App\Filters;
use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Config\Services;
use Exception;
class JWTAuthFilter implements FilterInterface
{
public function before(RequestInterface $request, $arguments = null)
{
try {
helper('jwt');
jwtValidateRequest(jwtRequest($request->getServer('HTTP_AUTHORIZATION')));
return $request;
} catch (Exception $e) {
return Services::response()->setJSON(['error' => $e->getMessage()])->setStatusCode(ResponseInterface::HTTP_UNAUTHORIZED);
}
}
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
{
}
}

View File

@ -0,0 +1,142 @@
<?php
namespace App\Filters;
use App\Models\SettingsModel;
use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Exception;
class LoginAuthFilter implements FilterInterface
{
public function before(RequestInterface $request, $arguments = null)
{
try {
if(!$this->validateIgnoreControllerAccess()){
$session = session();
$token = $session->get('token')??'';
$tfa = $session->get('tfa')??false;
$this->getSettings();
if (empty($token) || $tfa == true) {
return redirect()->to('/login');
}else{
$this->validateControllerAccess();
}
}
} catch (Exception $e) {
}
}
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
{
}
/**
* Access to controllers is valid.
*/
public function validateControllerAccess(){
$request = \Config\Services::request();
$uri = $request->uri;
$language = \Config\Services::language();
$language->setLocale(session()->lang);
$getWhiteList = $this->whiteListController();
foreach ($getWhiteList as $item){
if(strtolower($item) == $uri->getSegment(1)){
return true;
}
}
$getRules = json_decode(session()->get('rules')??'[]');
foreach ($this->whiteListMethod() as $item){
if(strtolower($item) == $uri->getSegment(2)){
return true;
}
}
foreach ($getRules as $key=>$value){
if(strtolower($key) == $uri->getSegment(1)){
if($uri->getTotalSegments() <= 1){
return true;
}
foreach ($value as $item){
if(strtolower($item) == $uri->getSegment(2)){
return true;
}
}
}
}
session()->setFlashdata('sweet', ['error',lang("App.dashboard_alert_rules")]);
header('Location: /home');
exit();
}
/**
* Returns the white list of allowed controllers.
*/
public function whiteListController(){
return [
'',
'BaseController',
'Home',
'Login',
'Oauth',
'Language',
'Api',
'Cron',
'lang',
'Ajax',
'Integration',
'Migrate',
'Test'
];
}
/**
* Returns the whitelist of public controllers.
*/
public function ignoreListController(){
return [
];
}
public function validateIgnoreControllerAccess(){
$request = \Config\Services::request();
$uri = $request->uri;
$getList = $this->ignoreListController();
foreach ($getList as $item){
if(strtolower($item) == $uri->getSegment(1)){
return true;
}
}
return false;
}
public function whiteListMethod(){
return [
'initController',
'__construct',
'validateControllerAccess',
'whiteListController',
'whiteListMethod'
];
}
public function getSettings(){
// Get Settings
$session = session();
$settingsBase = new SettingsModel();
$settings = $settingsBase->first()??[];
$session->set('settings', $settings);
if(empty($session->get('lang'))) {
$session->set('lang', $settings['default_language'] ?? 'en');
}
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Filters;
use App\Models\SettingsModel;
use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Config\Services;
use Exception;
class ThrottlerFilter implements FilterInterface
{
use ResponseTrait;
public function before(RequestInterface $request, $arguments = null)
{
try {
$throttler = Services::throttler();
$ip = $request->getIPAddress();
$settingsBase = new SettingsModel();
$settings = $settingsBase->first()??[];
if(!$settings['enable_api']){
return Services::response()->setJSON(['error' => 'ApiRest is currently disabled.'])->setStatusCode(ResponseInterface::HTTP_UNAUTHORIZED);
}
if($settings['block_external_api']){
if($ip != $settings['ip_allowed_api']??''){
return Services::response()->setJSON(['error' => 'Endpoint access from external domains is not allowed.'])->setStatusCode(ResponseInterface::HTTP_UNAUTHORIZED);
}
if ($throttler->check($ip, 60, MINUTE) === false)
{
return Services::response()->setStatusCode(429);
}
}
} catch (Exception $e) {
return Services::response()->setJSON(['error' => $e->getMessage()])->setStatusCode(ResponseInterface::HTTP_UNAUTHORIZED);
}
}
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
{
}
}

0
ci4/app/Helpers/.gitkeep Normal file
View File

View File

@ -0,0 +1,515 @@
<?php
////////////////////////////////////////////////////
/// Control Rules and Menus
////////////////////////////////////////////////////
function getAllClass($controller = null){
try {
helper('filesystem');
helper('directory');
if(strtolower(PHP_OS) == 'linux'){
$compatibility = '/';
}else{
$compatibility = '\\';
}
if(empty($controller)){
$map = directory_map(APPPATH.'Controllers');
foreach ($map as $key=>$item)
{
if(!strpos(strtolower($key),$compatibility)){
$name = str_replace('.php', '', $item);
if(!getIgnoreController($name)){
$controllers[] = [
'name' => $name,
'path' => '',
'methods' => get_class_methods('App\Controllers\\'.$name)
];
}
}else{
foreach ($item as $subitem){
$name = str_replace('.php', '', $subitem);
if(!getIgnoreController($name)) {
$controllers[] = [
'name' => $name,
'path' => $key,
'methods' => get_class_methods('App\Controllers\\' . str_replace('/', '\\', $key) . $name)
];
}
}
}
}
}else{
$array = explode('/',$controller);
$dir = count($array) > 1 ? $array[0] : '';
$name = count($array) > 1 ? '\\'.$array[1] : $array[0];
$controllers[] = [
'name' => $name,
'path' => $dir,
'methods' => get_class_methods('App\Controllers\\'.str_replace('/','\\',$dir).$name)
];
}
return $controllers??[];
} catch (Exception $e) {
return [];
}
}
function getAllClassFolder($folder = null){
try {
helper('filesystem');
helper('directory');
if(!empty($folder)){
$map = directory_map(APPPATH.'Controllers');
foreach ($map as $key=>$item)
{
if(strtolower(PHP_OS) == 'linux'){
$compatibility = '/';
}else{
$compatibility = '\\';
}
if(str_replace($compatibility,'',strtolower($key)) == strtolower($folder)){
foreach ($item as $subitem){
$name = str_replace('.php', '', $subitem);
$controllers[] = [
'name' => $name,
'path' => $key,
'methods' => get_class_methods('App\Controllers\\'.str_replace('/','\\',$key).$name)
];
}
}
}
}
return $controllers??[];
} catch (Exception $e) {
return [];
}
}
function getAllFolder(){
try {
helper('filesystem');
helper('directory');
$map = directory_map(APPPATH.'Controllers',1);
if(strtolower(PHP_OS) == 'linux'){
$compatibility = '/';
}else{
$compatibility = '\\';
}
foreach ($map as $item) {
if(strpos(strtolower($item),$compatibility)){
$folders[] = str_replace($compatibility,"",$item);
}
}
return $folders??[];
} catch (Exception $e) {
return [];
}
}
function getIgnoreController($controller)
{
try {
$loginAuthFilter = new \App\Filters\LoginAuthFilter();
foreach ($loginAuthFilter->whiteListController() as $item){
if($controller == $item){
return true;
}
}
return false;
} catch (Exception $e) {
return [];
}
}
function getIgnoreMethod($method)
{
try {
$loginAuthFilter = new \App\Filters\LoginAuthFilter();
foreach ($loginAuthFilter->whiteListMethod() as $item){
if($method == $item){
return true;
}
}
return false;
} catch (Exception $e) {
return [];
}
}
function getDictionary($word=''){
try {
$dictionary = [
'Group' => lang("App.group_rules_label_group"),
'User' => lang("App.group_rules_label_user"),
'Settings' => lang("App.group_rules_label_settings"),
'index' => lang("App.group_rules_label_index"),
'add' => lang("App.group_rules_label_add"),
'edit' => lang("App.group_rules_label_edit"),
'delete' => lang("App.group_rules_label_delete"),
'store' => lang("App.group_rules_label_store"),
'oauth' => lang("App.group_rules_label_oauth"),
'template' => lang("App.group_rules_label_template"),
'all' => lang("App.group_rules_label_all"),
'my' => lang("App.group_rules_label_my"),
'view' => lang("App.group_rules_label_view"),
'oauth_store' => lang("App.group_rules_label_oauth_store"),
'template_store' => lang("App.group_rules_label_template_store"),
];
return array_key_exists($word,$dictionary)?$dictionary[$word] : $word;
} catch (Exception $e) {
return '';
}
}
function getMenuControl(){
try {
$getClass = getAllClass();
$getRules = json_decode(session()->get('rules')??'[]');
foreach ($getClass as $item){
foreach ($getRules as $key=>$value){
if($key == $item['name']){
$item['methods'] = $value;
$data[] = $item;
}
}
}
return $data??[];
} catch (Exception $e) {
session()->setFlashdata('alert', 'error_acesso');
return [];
}
}
function getArrayItem(array $array, $key, $word, $isArray=false)
{
try {
foreach ($array as $item){
if ($isArray){
foreach ($item[$key] as $subitem){
if($subitem == $word){
$data[]=$subitem;
}
}
}else{
if($item[$key] == $word){
$data[]=$item;
}
}
}
return $data??[];
} catch (Exception $e) {
return [];
}
}
////////////////////////////////////////////////////
/// Notification Messages
////////////////////////////////////////////////////
function formAlert()
{
$session = session();
$alert = $session->getFlashdata('error');
$validation = \Config\Services::validation()->listErrors();
if (!empty($alert)){
return '<div class="alert alert-danger alert-dismissible alert-alt solid fade show">'.
' <button type="button" class="close h-100" data-dismiss="alert" aria-label="Close"><span><i class="mdi mdi-close"></i></span>'.
' </button>'. $validation .
'</div>';
}
}
function sweetAlert()
{
try {
$session = session();
$alert = $session->getFlashdata('sweet');
if (count((array)$alert) == 2){
return "<script>".
" $(document).ready(function () {".
" 'use strict';".
" swal({".
" position: 'center',".
" type: '".$alert[0]."',".
" title: '".$alert[1]."',".
" showConfirmButton: false,".
" timer: 2000,".
" confirmButtonClass: 'btn btn-primary',".
" buttonsStyling: false".
" });".
" });".
"</script>";
}
if (count((array)$alert) == 4){
return "<script>".
" $(document).ready(function () {".
" 'use strict';".
" swal({".
" title: '".$alert[1]."',".
" text: '".$alert[2]."',".
" type: '".$alert[0]."',".
" showCancelButton: !0,".
" confirmButtonColor: '#f34141',".
" confirmButtonText: 'Sim, Deletar!',".
" cancelButtonText: 'Cancelar',".
" closeOnConfirm: !1".
" }).then(function(isConfirm) {".
" if (isConfirm.value) {".
" window.location.href = '".$alert[3]."'".
" }".
" });".
" });".
"</script>";
}
}catch (Exception $ex){
}
}
function toastAlert()
{
try {
$session = session();
$alert = $session->getFlashdata('toast');
if (count((array)$alert) == 3) {
return "<script>" .
" $(document).ready(function () {" .
" 'use strict';".
" let config = {" .
" positionClass: 'toast-top-center'," .
" timeOut: 5e3," .
" closeButton: !0," .
" debug: !1," .
" newestOnTop: !0," .
" progressBar: !0," .
" preventDuplicates: !0," .
" onclick: null," .
" showDuration: '300'," .
" hideDuration: '1000'," .
" extendedTimeOut: '1000'," .
" showEasing: 'swing'," .
" hideEasing: 'linear'," .
" showMethod: 'fadeIn'," .
" hideMethod: 'fadeOut'," .
" tapToDismiss: !1" .
" };" .
" toastr." . $alert[0] . "('" . $alert[2] . "','" . $alert[1] . "',config);" .
" });" .
"</script>";
}
}catch (Exception $ex){
}
}
////////////////////////////////////////////////////
/// Security
////////////////////////////////////////////////////
function generatePassword($length = 8) {
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_!@#$%&*()-+{[]}';
$count = mb_strlen($chars);
for ($i = 0, $result = ''; $i < $length; $i++) {
$index = Rand(0, $count - 1);
$result .= mb_substr($chars, $index, 1);
}
return $result;
}
////////////////////////////////////////////////////
/// Others
////////////////////////////////////////////////////
function now_db() {
$unixdatetime = time();
return strftime("%Y-%m-%d %H:%M:%S", $unixdatetime);
}
function escape_value($value='') {
$value = strip_tags(htmlentities($value));
return filter_var($value, FILTER_SANITIZE_STRING);
}
function escape_only($value='') {
$value = strip_tags(htmlentities($value), '<b><i><u><p><a><img>');
return filter_var($value, FILTER_SANITIZE_SPECIAL_CHARS);
}
function unescape($value='') {
return html_entity_decode($value,null,'UTF-8');;
}
function redirect_to( $location = NULL ) {
if ($location != NULL) {
header("Location: {$location}");
exit;
}
}
function momentDateJS() {
$format = session()->get('settings')['default_date_format'];
switch ($format) {
case "Y-m-d":
return "YYYY-MM-DD";
case "d-m-Y":
return "DD-MM-YYYY";
case "d/m/Y":
return "DD/MM/YYYY";
case "m-d-Y":
return "MM-DD-YYYY";
case "m/d/Y":
return "MM/DD/YYYY";
default:
return "";
}
}
function momentDateTimeJS() {
$format = session()->get('settings')['default_date_format'];
switch ($format) {
case "Y-m-d":
return "YYYY-MM-DD HH:mm:ss";
case "d-m-Y":
return "DD-MM-YYYY HH:mm:ss";
case "d/m/Y":
return "DD/MM/YYYY HH:mm:ss";
case "m-d-Y":
return "MM-DD-YYYY HH:mm:ss";
case "m/d/Y":
return "MM/DD/YYYY HH:mm:ss";
default:
return "";
}
}
function dateFormatWeb($date) {
$format = session()->get('settings')['default_date_format'];
switch ($format) {
case "Y-m-d":
return $date;
case "d-m-Y":
case "d/m/Y":
case "m-d-Y":
case "m/d/Y":
$phpDate = strtotime($date);
if(strlen($date) > 10){
return date( $format.' H:i:s', $phpDate);
}else{
return date( $format, $phpDate);
}
default:
return null;
}
}
function dateFormatMysql($date) {
$format = session()->get('settings')['default_date_format'];
switch ($format) {
case "Y-m-d":
return $date;
case "d-m-Y":
$dateTimeSplit = explode(' ',$date);
$dateSplit = explode('-',$dateTimeSplit[0]);
if(count($dateTimeSplit) > 1){
return $dateSplit[2].'-'.$dateSplit[1].'-'.$dateSplit[0].' '. $dateTimeSplit[1];
}else{
return $dateSplit[2].'-'.$dateSplit[1].'-'.$dateSplit[0];
}
case "d/m/Y":
$dateTimeSplit = explode(' ',$date);
$dateSplit = explode('/',$dateTimeSplit[0]);
if(count($dateTimeSplit) > 1){
return $dateSplit[2].'-'.$dateSplit[1].'-'.$dateSplit[0].' '. $dateTimeSplit[1];
}else{
return $dateSplit[2].'-'.$dateSplit[1].'-'.$dateSplit[0];
}
case "m-d-Y":
$dateTimeSplit = explode(' ',$date);
$dateSplit = explode('-',$dateTimeSplit[0]);
if(count($dateTimeSplit) > 1){
return $dateSplit[2].'-'.$dateSplit[0].'-'.$dateSplit[1].' '. $dateTimeSplit[1];
}else{
return $dateSplit[2].'-'.$dateSplit[0].'-'.$dateSplit[1];
}
case "m/d/Y":
$dateTimeSplit = explode(' ',$date);
$dateSplit = explode('/',$dateTimeSplit[0]);
if(count($dateTimeSplit) > 1){
return $dateSplit[2].'-'.$dateSplit[0].'-'.$dateSplit[1].' '. $dateTimeSplit[1];
}else {
return $dateSplit[2] . '-' . $dateSplit[0] . '-' . $dateSplit[1];
}
default:
return null;
}
}
function langJS() {
$lang = session()->get('lang')??'en';
switch ($lang) {
case "pt":
return "pt-br";
default:
return $lang;
}
}
function socialBG() {
return [
"facebook" => "bg-facebook",
"linkedin" => "bg-linkedin",
"google" => "bg-google-plus",
"youtube" => "bg-youtube",
"twitter" => "bg-twitter",
"instagram" => "bg-instagram",
"tiktok" => "bg-tiktok",
"whatsapp" => "bg-whatsapp",
"website" => "bg-website",
"api" => "bg-api",
"github" => "bg-github",
"slack" => "bg-slack",
"spotify" => "btn-spotify",
"reddit" => "btn-reddit",
"discord" => "btn-discord",
"dribbble" => "btn-dribbble",
"dropbox" => "btn-dropbox",
"gitlab" => "btn-gitlab",
"tumblr" => "btn-tumblr",
"strava" => "btn-strava",
"twitch" => "btn-twitch",
"vkontakte" => "btn-vk",
"wordpress" => "btn-wordpress",
"yahoo" => "btn-yahoo",
"bitbucket" => "btn-bitbucket",
"wechat" => "btn-wechat",
];
}
function keywordEmail() {
return [
'user_first_name',
'user_last_name',
'user_date_birth',
'user_address',
'user_city',
'user_state',
'user_country',
'user_zip_code',
'user_mobile',
'user_email',
'user_picture'
];
}
function templateSelect($templates=[],$name='',$type='') {
foreach ($templates as $item){
if($item['type'] == $type){
if($item['name'] == $name){
return $item;
}
}
}
return null;
}
function version() {
return "1.2.1";
}

View File

@ -0,0 +1,59 @@
<?php
use App\Models\SettingsModel;
use App\Models\UserModel;
use Firebase\JWT\JWT;
/**
* Receives JWT authentication header and returns a string.
* @access public
* @param string $authHeader
* @return string
*/
if(!function_exists('jwtRequest')) {
function jwtRequest($authHeader){
if (is_null($authHeader)) {
throw new Exception('Missing or invalid jwt access token.');
}
return explode(' ', $authHeader)[1];
}
}
/**
* Validates the token by decrypting and checking the database.
* @access public
* @param string $token
* @return array
*/
if(!function_exists('jwtValidateRequest')) {
function jwtValidateRequest(string $token)
{
$settingsBase = new SettingsModel();
$settings = $settingsBase->first()??[];
$decode = JWT::decode($token, $settings['jwt_private_key']??'', ['HS256']);
$userModel = new UserModel();
return $userModel->where('email', $decode->email)->first();
}
}
/**
* Signs a new token.
* @access public
* @param string $email
* @return string
*/
if(!function_exists('jwtSignature')) {
function jwtSignature(string $email)
{
$settingsBase = new SettingsModel();
$settings = $settingsBase->first()??[];
$time = time();
$expiration = $time + (intval($settings['jwt_token_lifetime']??0) * 60);
$payload = [
'email' => $email,
'iat' => $time,
'exp' => $expiration,
];
return JWT::encode($payload, $settings['jwt_private_key']??'');
}
}

View File

602
ci4/app/Language/en/App.php Normal file
View File

@ -0,0 +1,602 @@
<?php
return [
// MENUS
"menu_dashboard" => "Dashboard",
"menu_registration" => "Registration",
"menu_users" => "Users",
"menu_permission_group" => "Permission Group",
"menu_settings" => "Settings",
"menu_general" => "General",
"menu_logout" => "Logout",
"menu_profile" => "My Profile",
"menu_activity" => "Activities",
"menu_notification" => "Notifications",
"menu_list" => "List",
"menu_add" => "Add",
"menu_oauth" => "Authentications",
"menu_template" => "Templates",
// LANGUAGES
"lang_en" => "English",
"lang_es" => "Spanish",
"lang_pt" => "Portuguese",
// GLOBAL
"global_minute" => "Minute",
"global_minutes" => "Minutes",
"global_hour" => "Hour",
"global_hours" => "Hours",
"global_day" => "Day",
"global_days" => "Days",
"global_week" => "Week",
"global_weeks" => "Weeks",
"global_month" => "Month",
"global_months" => "Months",
"global_come_back" => "Come back",
"global_save" => "Save",
"global_alert_save_success" => "Saved successfully!",
"global_alert_save_error" => "Oops, error saving!",
"global_activate" => "Activate",
"global_disable" => "Disable",
"global_active" => "Active",
"global_inactive" => "Inactive",
"global_copy" => "Copy",
"global_print" => "Print",
"global_excel" => "Excel",
"global_pdf" => "PDF",
// LOGIN - Index
"login_title" => "Sign in to your account",
"login_email" => "Email",
"login_email_ph" => "Type your email",
"login_password" => "Password",
"login_password_ph" => "Type your password",
"login_remember_me" => "Remember Me?",
"login_forgot_password" => "I forgot my password",
"login_access" => "Sign in",
"login_signup" => "Sign up",
"login_signup_desc" => "Don't have an account?",
// LOGIN - forgot_password
"login_title_forgot_password" => "Recover Password",
"login_request" => "Request",
"login_come_back" => "Come back",
"login_wait" => "Wait...",
// LOGIN - authentication
"login_title_otp" => "2FA Authentication",
"login_otp_code" => "OTP Code",
"login_otp_span" => "Open Google Authenticator and enter the code generated below:",
// LOGIN - recovery
"login_title_recovery" => "New password",
"login_new_password" => "New password",
"login_btn_recovery" => "Change Password",
// LOGIN - signup
"login_title_signup" => "New Account",
"login_first_name" => "First Name",
"login_first_name_ph" => "Type your first name",
"login_last_name" => "Last Name",
"login_last_name_ph" => "Type your last name",
"login_accept_terms" => "I accept the terms",
"login_read_terms" => "Read the terms",
"login_terms_use" => "Terms of use",
"login_accept" => "Accepted",
"login_closed" => "Closed",
"login_register" => "Register",
// LOGIN - notification
"login_alert" => "Attention!",
"login_alert_success" => "Congratulations!",
"login_alert_send" => "Sent!",
"login_alert_terms" => "You must accept the terms.",
"login_alert_captcha_invalid" => "Captcha code is invalid.",
"login_alert_captcha_not_found" => "Captcha not found.",
"login_alert_user_blocked" => "User temporarily blocked by ",
"login_alert_pass_invalid" => "Invalid password.",
"login_alert_pass_invalid_2" => "Invalid password, ",
"login_alert_pass_attempt" => " attempt to ",
"login_alert_disabled_access" => "Access temporarily disabled.",
"login_alert_user_not_found" => "User not found.",
"login_alert_code_invalid" => "Code is invalid.",
"login_alert_parameter_invalid" => "Invalid parameter.",
"login_alert_success_register" => "Registration successfully Complete!",
"login_alert_success_recovery" => "Password changed successfully!",
"login_alert_send_pass" => "Password recovery link, sent by email.",
"login_alert_error_email" => "Error trying to send email.",
"login_alert_error_pass" => "Error trying to recover password.",
"login_alert_empty_token" => "Missing token!",
"login_alert_invalid_token" => "Invalid token!",
"login_alert_success_confirmation" => "Confirmed successfully!",
// LOGIN - rules
"login_rules_first_name_r" => "The first name field is required!",
"login_rules_last_name_r" => "The last name field is mandatory!",
"login_rules_email_r" => "The email field is mandatory!",
"login_rules_email_i" => "The email {value} has already been registered!",
"login_rules_email_v" => "The email must be valid!",
"login_rules_password_r" => "The password field is required!",
"login_rules_password_m" => "The password must be at least 8 characters long!",
// DASHBOARD - admin
"dashboard_title" => "Panel",
"dashboard_user_total" => "General",
"dashboard_user_new" => "New",
"dashboard_user_enabled" => "Active",
"dashboard_user_disabled" => "Inactive",
"dashboard_grid_user" => "Latest Registrations",
"dashboard_grid_access" => "Latest Access",
"dashboard_chart_history" => "Registration History",
"dashboard_chart_months" => "Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec",
"dashboard_hello" => "Hello, ",
"dashboard_good_morning" => "good morning",
"dashboard_good_afternoon" => "good afternoon",
"dashboard_good_night" => "good night",
"dashboard_indicators" => "Below are some indicators for today!",
"dashboard_user" => "User",
"dashboard_email" => "Email",
"dashboard_created_at" => "Last Acess",
"dashboard_alert_rules" => "Access denied!<br>do not have permission",
// PROFILE - form
"profile_title" => "My Profile",
"profile_subtitle" => "My Informations",
"profile_subtitle_image" => "Profile Image",
"profile_subtitle_tfa" => "Two-Factor Authentication (2FA)",
"profile_first_name" => "First Name",
"profile_first_name_ph" => "Type your first name",
"profile_last_name" => "Last Name",
"profile_last_name_ph" => "Type your last name",
"profile_email" => "Email",
"profile_email_ph" => "Type your email",
"profile_mobile" => "Cell Phone",
"profile_mobile_ph" => "Type your mobile number",
"profile_password" => "Change Password",
"profile_password_ph" => "Type your password",
"profile_confirm_password" => "Confirm Password",
"profile_confirm_password_ph" => "Confirm your previous password",
"profile_date_birth" => "Birth Date",
"profile_date_birth_ph" => "Select birth date",
"profile_address" => "Address",
"profile_address_ph" => "Type your address",
"profile_city" => "City",
"profile_city_ph" => "Type your city",
"profile_state" => "State/Province",
"profile_state_ph" => "Type your state/province",
"profile_country" => "Country",
"profile_zip_code" => "Zip Code",
"profile_zip_code_ph" => "Type your zip code",
"profile_language" => "Language",
"profile_msg_desc_1" => "Define your information below:",
"profile_msg_desc_2" => "Define your location below:",
"profile_change_photo" => "Change Photo",
"profile_qrcode" => "Google Authenticator QR Code:",
"profile_backup_code" => "Backup Codes:",
"profile_change_image" => "Choose one of the options below:",
"profile_upload_msg" => "Upload",
"profile_no_image_msg" => "No photo",
"profile_gravatar_msg" => "Gravatar",
"profile_tfa_msg" => "Use 2FA Authentication",
"profile_tfa_secret" => "Secret Key:",
"profile_tfa_download" => "Download Information",
// PROFILE - rules
"profile_rules_first_name_r" => "The first name field is required!",
"profile_rules_last_name_r" => "The last name field is mandatory!",
"profile_rules_email_r" => "The email field is mandatory!",
"profile_rules_email_i" => "The email {value} has already been registered!",
"profile_rules_email_v" => "The email must be valid!",
"profile_rules_password_r" => "The password field is required!",
"profile_rules_password_m" => "The password must be at least 8 characters long!",
"profile_rules_password_confirm_m" => "The password field is different from the confirm password field.",
// ACTIVITY - form
"activity_title" => "Activities",
"activity_subtitle" => "Access Activities",
"activity_grid_user" => "USer",
"activity_grid_level" => "Alert",
"activity_grid_event" => "Event",
"activity_grid_ip" => "IP Address",
"activity_grid_os" => "System",
"activity_grid_browser" => "Browser",
"activity_grid_created" => "Created In",
"activity_alert_information" => "Information",
"activity_alert_throttling" => "Access Attempt",
"activity_alert_recovery" => "Password Recovery",
"activity_alert_error" => "Error",
"activity_alert_login_auth" => "Authentication",
"activity_top_windows" => "Windows",
"activity_top_mac" => "Apple OS",
"activity_top_linux" => "Linux",
"activity_top_mobile" => "Android / IOS",
"activity_top_chrome" => "Chrome",
"activity_top_firefox" => "FireFox",
"activity_top_safari" => "Safari",
"activity_top_edge" => "EDGE / IE",
"activity_all_btn" => "View All",
// USER - index
"user_title" => "Users",
"user_subtitle" => "User List",
"user_btn_add" => "Add New",
"user_btn_edit" => "Edit",
"user_btn_delete" => "Delete",
"user_grid_name" => "Name",
"user_grid_email" => "Email",
"user_grid_group" => "Group",
"user_grid_last_access" => "Last Access",
"user_grid_last_ip" => "Last IP",
"user_grid_created" => "Date Created",
"user_grid_options" => "Options",
"user_delete_title" => "Are you sure you want to delete?",
"user_delete_subtitle" => "You will not be able to retrieve this information!",
"user_delete_btn_ok" => "Yes, Delete!",
"user_delete_btn_cancel" => "Cancel",
"user_alert_add" => "Added successfully!",
"user_alert_edit" => "Successfully edited!",
"user_alert_delete" => "Successfully deleted!",
// USER - form
"user_add_title" => "New User",
"user_add_subtitle" => "Add New Users",
"user_edit_title" => "Edit User",
"user_edit_subtitle" => "Edit User",
"user_field_first_name" => "First Name",
"user_field_first_name_ph" => "Type your first name",
"user_field_last_name" => "Last Name",
"user_field_last_name_ph" => "Type your last name",
"user_field_email" => "Email",
"user_field_email_ph" => "Type your email",
"user_field_cell" => "Cell Phone",
"user_field_cell_ph" => "Type your mobile number",
"user_field_group" => "Permission Group",
"user_field_password" => "Password",
"user_field_password_ph" => "Type your password",
"user_field_password_confirm" => "Confirm Password",
"user_field_password_confirm_ph" => "Confirm your previous password",
"user_field_status" => "Registration Status",
"user_field_date_birth" => "Birth Date",
"user_field_date_birth_ph" => "Select birth date",
"user_field_address" => "Address",
"user_field_address_ph" => "Type your address",
"user_field_city" => "City",
"user_field_city_ph" => "Type your city",
"user_field_state" => "State/Province",
"user_field_state_ph" => "Type your state/province",
"user_field_country" => "Country",
"user_field_zip_code" => "Zip Code",
"user_field_zip_code_ph" => "Type your zip code",
"user_field_language" => "Language",
"user_msg_desc_1" => "Define the user information below:",
"user_msg_desc_2" => "Define the user's location information below:",
"user_grid_mobile" => "Mobile",
"user_field_email_confirmed" => "Email Status",
"user_alert_confirmed" => "Confirmed",
"user_alert_not_confirmed" => "Not Confirmed",
"user_alert_email_confirmed" => "Please confirm your email.",
// USER - rules
"user_rules_first_name_r" => "The first name field is required!",
"user_rules_last_name_r" => "The last name field is mandatory!",
"user_rules_email_r" => "The email field is mandatory!",
"user_rules_email_i" => "The email {value} has already been registered!",
"user_rules_email_v" => "The email must be valid!",
"user_rules_password_r" => "The password field is required!",
"user_rules_password_m" => "The password must be at least 8 characters long!",
"user_rules_password_confirm_m" => "The password field is different from the confirm password field.",
// GROUP - index
"group_title" => "Permission Group",
"group_subtitle" => "Permissions Group List",
"group_btn_add" => "Add New",
"group_btn_edit" => "Edit",
"group_btn_delete" => "Delete",
"group_grid_title" => "Title",
"group_grid_dashboard" => "Dashboard",
"group_grid_created" => "Date Created",
"group_grid_updated" => "Updated Date",
"group_grid_options" => "Options",
"group_delete_title" => "Are you sure you want to delete?",
"group_delete_subtitle" => "You will not be able to retrieve this information!",
"group_delete_btn_ok" => "Yes, Delete!",
"group_delete_btn_cancel" => "Cancel",
"group_alert_add" => "Added successfully!",
"group_alert_edit" => "Successfully edited!",
"group_alert_delete" => "Successfully deleted!",
"group_alert_error" => "It has users linked to this group!",
// GROUP - form
"group_add_title" => "New Group",
"group_add_subtitle" => "Add New Permission Group",
"group_edit_title" => "Edit Group",
"group_edit_subtitle" => "Edit Permission Group",
"group_field_title" => "Group's name",
"group_field_dashboard" => "Dashboard (Overview)",
"group_btn_select" => "Select all",
"group_btn_remove" => "Remove all",
"group_label_user" => "User",
"group_label_admin" => "Administrator",
// GROUP - rules
"group_rules_title_r" => "The group name field is mandatory!",
"group_rules_dashboard_r" => "The panel field is mandatory!",
// GROUP - Rules Name
"group_rules_label_group" => "Group Permission",
"group_rules_label_user" => "User",
"group_rules_label_settings" => "Settings",
"group_rules_label_index" => "List",
"group_rules_label_add" => "Add",
"group_rules_label_edit" => "Edit",
"group_rules_label_delete" => "Delete",
"group_rules_label_store" => "Save",
"group_rules_label_oauth" => "Authentications",
"group_rules_label_template" => "Templates",
"group_rules_label_all" => "View All",
"group_rules_label_my" => "My Notifications",
"group_rules_label_view" => "View Notification",
"group_rules_label_oauth_store" => "Save oAuth",
"group_rules_label_template_store" => "Save Templates",
// AUTH - index
"oauth_title" => "oAuth Authentication",
"oauth_subtitle" => "Social Network Authentication Settings",
"oauth_label_id" => "Account ID",
"oauth_label_id_ph" => "Type your account id",
"oauth_label_key" => "Account Key",
"oauth_label_key_ph" => "Type your account key",
"oauth_label_secret" => "Secret Key",
"oauth_label_secret_ph" => "Type your secret key",
"oauth_label_view" => "Show Text",
"oauth_label_active" => "Activate Social Network",
"oauth_alert_add" => "Saved successfully!",
"oauth_alert_error" => "Error saving!",
// TEMPLATE - index
"template_title" => "Templates",
"template_subtitle" => "Template Settings",
"template_subtitle_email" => "Email Templates",
"template_label_title" => "Title",
"template_label_title_ph" => "Type your title",
"template_label_message" => "Message",
"template_label_forgot_pass" => "Forgot password",
"template_label_welcome" => "Welcome",
"template_label_tfa" => "Two-Factor Authentication (2FA)",
"template_label_tag" => "View Keywords",
"template_alert_add" => "Saved successfully!",
"template_alert_error" => "Error saving!",
"template_modal_title" => "Key words",
"template_modal_subtitle" => "Below are some keywords that can be incorporated into the text:",
"template_modal_btn_1" => "Close",
"template_modal_copy" => "Copied!",
"template_modal_copy_msg" => "Successfully copied!",
"template_label_confirmation_email" => "Email Confirmation",
"template_label_notification" => "New Accounts Notification",
// SETTINGS - index
"settings_title" => "Settings",
"settings_subtitle" => "General Settings",
"settings_label_general" => "General",
"settings_label_general_title" => "General Settings",
"settings_label_general_subtitle_1" => "Set page settings below:",
"settings_label_general_subtitle_2" => "Set the default initial settings below:",
"settings_label_email" => "Email",
"settings_label_email_title" => "Email Settings",
"settings_label_email_subtitle_1" => "Set the email sending settings below:",
"settings_label_captcha" => "Captcha",
"settings_label_captcha_title" => "Captcha Settings",
"settings_label_captcha_subtitle_1" => "Set the captcha usage settings below:",
"settings_label_captcha_subtitle_2" => "Set the captcha display location below:",
"settings_label_auth" => "Authentication",
"settings_label_auth_title" => "Authentication Settings",
"settings_label_auth_subtitle_1" => "Define below whether you want to enable two-factor authentication:",
"settings_label_auth_subtitle_2" => "Define below whether you want to block access attempts:",
"settings_label_storage" => "Storage",
"settings_label_storage_title" => "Storage Settings",
"settings_label_storage_subtitle_1" => "Set the default storage gateway below:",
"settings_label_storage_subtitle_2" => "Set your Amazon S3 or MinIO storage settings below:",
"settings_label_backup" => "MySql Backup",
"settings_label_backup_title" => "Data Backup Settings",
"settings_label_backup_subtitle_1" => "Set the backup settings below:",
"settings_label_backup_btn_1" => "Generate and Download Backup",
"settings_label_register" => "Records",
"settings_label_register_title" => "Registration and Login Settings",
"settings_label_register_subtitle_1" => "Set registration and login settings for new users below:",
"settings_label_notification" => "Notifications",
"settings_label_notification_title" => "Notifications Settings",
"settings_label_notification_subtitle_1" => "Set below if you want to receive notifications from new users by:",
"settings_label_api" => "API",
"settings_label_api_title" => "API Settings",
"settings_label_api_subtitle_1" => "Set below if you want to enable API usage:",
"settings_label_logs" => "Logs",
"settings_label_logs_title" => "Logs Settings",
"settings_label_logs_subtitle_1" => "Define below whether you want to clear access logs frequently:",
"settings_field_title" => "Page Title",
"settings_field_title_ph" => "Enter page title",
"settings_field_logo" => "",
"settings_field_icon" => "",
"settings_field_default_language" => "Language",
"settings_field_default_role" => "Group User Permission",
"settings_field_default_date_format" => "Date Format",
"settings_field_default_hour_format" => "Time Format",
"settings_field_default_currency" => "Currency",
"settings_field_default_currency_position" => "Currency Symbol",
"settings_field_default_currency_position_left" => "Left",
"settings_field_default_currency_position_right" => "On the Right",
"settings_field_default_currency_separation" => "Currency Separation",
"settings_field_default_currency_separation_dot" => "Per Point 0.00",
"settings_field_default_currency_separation_coma" => "Per Comma 0.00",
"settings_field_default_country" => "Country",
"settings_field_default_theme" => "Layout Backend",
"settings_field_default_theme_front" => "Layout Frontend",
"settings_field_frontend" => "Activate Frontend",
"settings_field_default_timezone" => "Timezone",
"settings_field_seo_description" => "Description (SEO)",
"settings_field_seo_keywords" => "Keywords (SEO)",
"settings_field_test_send" => "Please do a test submission to verify that the above settings are correct.",
"settings_field_test_send_btn" => "Send",
"settings_field_email_gateway" => "Email Gateway",
"settings_field_email_gateway_smtp" => "SMTP",
"settings_field_email_name" => "Name in Email",
"settings_field_email_name_ph" => "Enter name in email",
"settings_field_email_address" => "Email Address",
"settings_field_email_address_ph" => "Enter email address",
"settings_field_email_smtp" => "Server (Host)",
"settings_field_email_smtp_ph" => "Enter the host address",
"settings_field_email_port" => "Port (Host)",
"settings_field_email_port_ph" => "Enter the host port",
"settings_field_email_pass" => "Email Password",
"settings_field_email_pass_ph" => "Enter email password",
"settings_field_email_cert" => "Authentication",
"settings_field_email_cert_none" => "None",
"settings_field_email_cert_ssl" => "SSL",
"settings_field_email_cert_tls" => "TLS",
"settings_field_email_account_id" => "Account ID",
"settings_field_email_account_id_ph" => "Enter Account ID",
"settings_field_email_auth_token" => "Token Auth",
"settings_field_email_auth_token_ph" => "Enter Authentication Token",
"settings_field_email_info_add" => "Additional Information",
"settings_field_email_info_add_ph" => "Enter information",
"settings_field_captcha_gateway" => "Gateway Captcha",
"settings_field_captcha_gateway_recaptcha" => "reCaptcha",
"settings_field_captcha_gateway_hcaptcha" => "hCaptcha",
"settings_field_captcha_site_key" => "Site Key",
"settings_field_captcha_site_key_ph" => "Enter site key",
"settings_field_captcha_secret_key" => "Secret Key",
"settings_field_captcha_secret_key_ph" => "Enter secret key",
"settings_field_captcha_register" => "Captcha Registration Screen",
"settings_field_captcha_login" => "Captcha Login Screen",
"settings_field_captcha_recovery" => "Captcha Password Recovery",
"settings_field_registration" => "Registration Screen",
"settings_field_terms_conditions" => "Terms and Conditions",
"settings_field_terms_conditions_text" => "Terms and Conditions",
"settings_field_email_confirmation" => "Email confirmation",
"settings_field_send_welcome_message" => "Welcome Email",
"settings_field_remember_me" => "Remember Me",
"settings_field_forgot_password" => "Forgot Password",
"settings_field_send_email_register" => "Email",
"settings_field_send_notification_register" => "Panel Notification",
"settings_field_two_factor_auth" => "Two Factor (2FA)",
"settings_field_throttle_auth" => "Authentication of Attempts",
"settings_field_throttle_auth_max_attempts" => "Numbers of Attempts",
"settings_field_throttle_auth_max_attempts_ph" => "Enter the number of attempts",
"settings_field_throttle_auth_lockour_time" => "Lockout Time",
"settings_field_throttle_auth_lockour_time_ph" => "Enter time interval",
"settings_field_jwt_token_lifetime" => "JWT Token Time",
"settings_field_jwt_token_lifetime_ph" => "Enter token renewal time",
"settings_field_jwt_private_key" => "JWT Private Key",
"settings_field_jwt_private_key_ph" => "Enter private key",
"settings_field_enable_api" => "API RestFul",
"settings_field_remove_log" => "Remove Logs",
"settings_field_remove_log_time" => "Clear every",
"settings_field_remove_log_time_ph" => "Enter the number of days to clear",
"settings_field_remove_log_last_date" => "Last Cleanup",
"settings_field_storage_gateway" => "Storage Gateway",
"settings_field_storage_gateway_local" => "Local",
"settings_field_storage_gateway_aws" => "Amazon S3",
"settings_field_storage_gateway_minio" => "MinIO",
"settings_field_backup_storage" => "Storage",
"settings_field_backup_table" => "Table",
"settings_field_backup_table_all" => "All",
"settings_field_backup_table_user" => "Users",
"settings_field_backup_table_settings" => "Settings",
"settings_field_backup_email" => "Email Notification",
"settings_field_backup_email_ph" => "Enter notification email",
"settings_field_backup_notification_email" => "Notify by Email",
"settings_field_backup_automatic" => "Automatic Backup (Cron)",
"settings_field_backup_time" => "Time",
"settings_alert_add" => "Successfully saved!",
"settings_alert_error" => "Error saving!",
"settings_label_cron" => "Cron Tasks",
"settings_label_cron_title" => "Cron Tasks Settings",
"settings_label_cron_subtitle_1" => "Below is shown how to configure cron tasks on your hosting.",
"settings_label_cron_subtitle_2" => "The latest error records in crontab are listed below.",
"settings_label_cron_timer" => "CronTab Timer:",
"settings_label_cron_timer_time" => "Every 5 minutes (*/5 * * * *)",
"settings_field_aws_endpoint" => "endpoint (MinIO)",
"settings_field_aws_endpoint_ph" => "Enter endpoint for MinIO",
"settings_field_aws_key" => "Key",
"settings_field_aws_key_ph" => "Enter key",
"settings_field_aws_secret" => "Secret Key",
"settings_field_aws_secret_ph" => "Enter secret key",
"settings_field_aws_region" => "Region",
"settings_field_aws_region_ph" => "Enter region",
"settings_field_aws_bucket" => "Bucket",
"settings_field_aws_bucket_ph" => "Bucket name",
"settings_field_send_user_register" => "User who will receive notifications",
"settings_label_api_subtitle_2" => "Below all calls to APIRest are listed.",
"settings_label_api_users" => "Users",
"settings_label_api_auth" => "Authentication and Status Service",
"settings_label_api_download" => "Download Postman Collection",
"settings_field_group_api" => "Group Access Allowed",
"settings_field_block_api" => "Block External Access",
"settings_field_ip_api" => "Allowed IP Address",
"settings_field_ip_api_ph" => "Set an IP address if you set external blocking.",
"settings_grid_routine" => "Cron Routine",
"settings_group_grid_error" => "Error Message",
"settings_group_grid_created_at" => "Registration Date",
"settings_alert_email_test_send" => "Sent with success!",
"settings_alert_email_test_error" => "Error sending!",
// NOTIFICATION - index
"notification_title" => "Notifications",
"notification_subtitle" => "Notification List",
"notification_btn_add" => "Add New",
"notification_btn_edit" => "Edit",
"notification_btn_delete" => "Delete",
"notification_grid_sender" => "Sender",
"notification_grid_recipient" => "Recipient",
"notification_grid_title" => "Title",
"notification_grid_dashboard" => "Dashboard",
"notification_grid_created" => "Date Created",
"notification_grid_updated" => "Date Updated",
"notification_grid_email" => "Email Sent?",
"notification_grid_view" => "Read?",
"notification_grid_options" => "Options",
"notification_grid_yes" => "Yes",
"notification_grid_no" => "No",
"notification_delete_title" => "Are you sure you want to delete?",
"notification_delete_subtitle" => "You will not be able to retrieve this information!",
"notification_delete_btn_ok" => "Yes, Delete!",
"notification_delete_btn_cancel" => "Cancel",
"notification_alert_add" => "Successfully added!",
"notification_alert_edit" => "Edited successfully!",
"notification_alert_delete" => "Successfully deleted!",
// NOTIFICATION - form
"notification_add_title" => "New Notification",
"notification_add_subtitle" => "Add New Notification",
"notification_edit_title" => "Edit Notification",
"notification_edit_subtitle" => "Edit Notification",
"notification_field_title" => "Title",
"notification_field_title_ph" => "Enter title",
"notification_field_user" => "User",
"notification_field_user_all" => "All",
"notification_field_body" => "Message",
"notification_field_send_msg" => "Would you like to send the notification also by:",
"notification_field_send_email" => "Send by email?",
"notification_field_send_label" => "Send",
// NOTIFICATION - rules
"notification_rules_title_r" => "The title field is required!",
"notification_rules_body_r" => "Message field is required!",
// NOTIFICATION - Bell Header
"notification_title_my" => "My Notifications",
"notification_subtitle_my" => "Notification List",
"notification_subtitle_view" => "View My Notification",
"notification_bell_btn" => "See all notifications",
"notification_view_btn" => "View",
"notification_grid_view_my" => "Viewed",
"notification_grid_created_my" => "Received",
// CronTab and Demo Mode
"crontab_backup_success" => "Backup successfully generated on: ",
"crontab_backup_error" => "Error generating backup!",
"crontab_email_error" => "An error occurred while trying to send email.",
"general_demo_mode" => "System in Demo Mode!",
// v1.2.1
"global_select" => "Select an item",
];

View File

@ -0,0 +1,4 @@
<?php
// override core en language system validation or define your own en language validation message
return [];

602
ci4/app/Language/es/App.php Normal file
View File

@ -0,0 +1,602 @@
<?php
return [
// MENUS
"menu_dashboard" => "Panel",
"menu_registration" => "Registro",
"menu_users" => "Usuarios",
"menu_permission_group" => "Grupo Permisos",
"menu_settings" => "Ajustes",
"menu_general" => "General",
"menu_logout" => "Salir",
"menu_profile" => "Mi Perfil",
"menu_activity" => "Ocupaciones",
"menu_notification" => "Notificaciones",
"menu_list" => "Lista",
"menu_add" => "Agregar",
"menu_oauth" => "Autenticaciones",
"menu_template" => "Plantillas",
// LANGUAGES
"lang_en" => "Inglés",
"lang_es" => "Español",
"lang_pt" => "Portugués",
// GLOBAL
"global_minute" => "Minuto",
"global_minutes" => "Minutos",
"global_hour" => "Hora",
"global_hours" => "Horas",
"global_day" => "Día",
"global_days" => "Dias",
"global_week" => "Semana",
"global_weeks" => "Semanas",
"global_month" => "Mes",
"global_months" => "Meses",
"global_come_back" => "Volver",
"global_save" => "Guardar",
"global_alert_save_success" => "¡Guardado exitosamente!",
"global_alert_save_error" => "¡Error al guardar!",
"global_activate" => "Activar",
"global_disable" => "Desactivar",
"global_active" => "Activo",
"global_inactive" => "Inactivo",
"global_copy" => "Dupdo",
"global_print" => "Impresión",
"global_excel" => "Excel",
"global_pdf" => "PDF",
// LOGIN - Index
"login_title" => "Iniciar sesión en su cuenta",
"login_email" => "Correo Electrónico",
"login_email_ph" => "Escriba su correo electrónico",
"login_password" => "Contraseña",
"login_password_ph" => "Escribe tu contraseña",
"login_remember_me" => "Recuérdame",
"login_forgot_password" => "Olvidé la contraseña",
"login_access" => "Registrarse",
"login_signup" => "Inscribirse",
"login_signup_desc" => "¿Aún no tienes una cuenta?",
// LOGIN - forgot_password
"login_title_forgot_password" => "Recuperar contraseña",
"login_request" => "Solicitud",
"login_come_back" => "Vuelve",
"login_wait" => "Esperar...",
// LOGIN - authentication
"login_title_otp" => "Autenticación 2FA",
"login_otp_code" => "Código OTP",
"login_otp_span" => "Abra Google Authenticator e ingrese el código generado a continuación:",
// LOGIN - recovery
"login_title_recovery" => "Nueva contraseña",
"login_new_password" => "Nueva contraseña",
"login_btn_recovery" => "Cambiar Contraseña",
// LOGIN - signup
"login_title_signup" => "Nueva Cuenta",
"login_first_name" => "Nombre",
"login_first_name_ph" => "Escriba su nombre",
"login_last_name" => "Apellido",
"login_last_name_ph" => "Escriba su apellido",
"login_accept_terms" => "Acepto los términos",
"login_read_terms" => "Leer los términos",
"login_terms_use" => "Condiciones de uso",
"login_accept" => "Aceptada",
"login_closed" => "Cerrada",
"login_register" => "Registrarse",
// LOGIN - notification
"login_alert" => "¡Atención!",
"login_alert_success" => "¡Felicidades!",
"login_alert_send" => "¡Enviado!",
"login_alert_terms" => "Debes aceptar los términos.",
"login_alert_captcha_invalid" => "El código captcha no es válido.",
"login_alert_captcha_not_found" => "Captcha no encontrado.",
"login_alert_user_blocked" => "Usuario bloqueado temporalmente por ",
"login_alert_pass_invalid" => "Contraseña invalida.",
"login_alert_pass_invalid_2" => "Contraseña invalida, ",
"login_alert_pass_attempt" => " intento de ",
"login_alert_disabled_access" => "Acceso temporalmente deshabilitado.",
"login_alert_user_not_found" => "Usuario no encontrado.",
"login_alert_code_invalid" => "El codigo es invalido.",
"login_alert_parameter_invalid" => "Parametro invalido.",
"login_alert_success_register" => "¡Registro completado con éxito!",
"login_alert_success_recovery" => "¡Contraseña cambiada con éxito!",
"login_alert_send_pass" => "Enlace de recuperación de contraseña, enviado por correo electrónico.",
"login_alert_error_email" => "Error al intentar enviar correo electrónico.",
"login_alert_error_pass" => "Error al intentar recuperar la contraseña.",
"login_alert_empty_token" => "¡Falta token!",
"login_alert_invalid_token" => "¡Token no válido!",
"login_alert_success_confirmation" => "¡Confirmado correctamente!",
// LOGIN - rules
"login_rules_first_name_r" => "¡El campo de nombre es obligatorio!",
"login_rules_last_name_r" => "¡El campo de apellido es obligatorio!",
"login_rules_email_r" => "¡El campo de correo electrónico es obligatorio!",
"login_rules_email_i" => "¡El correo electrónico {value} ya ha sido registrado!",
"login_rules_email_v" => "¡El correo electrónico debe ser válido!",
"login_rules_password_r" => "¡El campo de contraseña es obligatorio!",
"login_rules_password_m" => "¡La contraseña debe tener al menos 8 caracteres!",
// DASHBOARD - admin
"dashboard_title" => "Panel",
"dashboard_user_total" => "General",
"dashboard_user_new" => "Nuevo",
"dashboard_user_enabled" => "Activo",
"dashboard_user_disabled" => "Inactivo",
"dashboard_grid_user" => "Últimos Récords",
"dashboard_grid_access" => "Últimos Éxitos",
"dashboard_chart_history" => "Registro Histórico",
"dashboard_chart_months" => "Ene, Feb, Mar, Abr, May, Jun, Jul, Ago, Sep, Oct, Nov, Dic",
"dashboard_hello" => "Aceno, ",
"dashboard_good_morning" => "buen día",
"dashboard_good_afternoon" => "buenas tardes",
"dashboard_good_night" => "buenas noches",
"dashboard_indicators" => "¡A continuación se muestran algunos indicadores para hoy!",
"dashboard_user" => "Usuario",
"dashboard_email" => "Correo Electrónico",
"dashboard_created_at" => "Ultimo Acceso",
"dashboard_alert_rules" => "Acceso denegado!<br>No tiene permiso",
// PROFILE - form
"profile_title" => "Mi Perfil",
"profile_subtitle" => "Mis Informaciones",
"profile_subtitle_image" => "Imagen de Perfil",
"profile_subtitle_tfa" => "Autenticación de dos factores (2FA)",
"profile_first_name" => "Nombre",
"profile_first_name_ph" => "Escriba su nombre",
"profile_last_name" => "Apellido",
"profile_last_name_ph" => "Escriba su apellido",
"profile_email" => "Correo Electrónico",
"profile_email_ph" => "Escriba su correo electrónico",
"profile_mobile" => "Teléfono Móvil",
"profile_mobile_ph" => "Escriba su número de celular",
"profile_password" => "Cambiar Contraseña",
"profile_password_ph" => "Escribe tu contraseña",
"profile_confirm_password" => "Confirmar seña",
"profile_confirm_password_ph" => "Confirma tu contraseña anterior",
"profile_date_birth" => "Fecha de Nacimiento",
"profile_date_birth_ph" => "Seleccionar fecha de nacimiento",
"profile_address" => "Dirección",
"profile_address_ph" => "Escriba su dirección",
"profile_city" => "Ciudad",
"profile_city_ph" => "Escriba su ciudad",
"profile_state" => "Estado",
"profile_state_ph" => "Escriba su estado",
"profile_country" => "País",
"profile_zip_code" => "Código Postal",
"profile_zip_code_ph" => "Escriba su código postal",
"profile_language" => "Idioma",
"profile_msg_desc_1" => "Defina su información a continuación:",
"profile_msg_desc_2" => "Defina su ubicación a continuación:",
"profile_change_photo" => "Cambiar Foto",
"profile_qrcode" => "Código QR del Autenticador de Google:",
"profile_backup_code" => "Códigos de respaldo:",
"profile_change_image" => "Elija una de las siguientes opciones:",
"profile_upload_msg" => "Cargar",
"profile_no_image_msg" => "Sin Imagen",
"profile_gravatar_msg" => "Gravatar",
"profile_tfa_msg" => "Usar Autenticación 2FA",
"profile_tfa_secret" => "Llave Secreta:",
"profile_tfa_download" => "Descargar Información",
// PROFILE - rules
"profile_rules_first_name_r" => "¡El campo de nombre es obligatorio!",
"profile_rules_last_name_r" => "¡El campo de apellido es obligatorio!",
"profile_rules_email_r" => "¡El campo de correo electrónico es obligatorio!",
"profile_rules_email_i" => "¡El correo electrónico {value} ya ha sido registrado!",
"profile_rules_email_v" => "¡El correo electrónico debe ser válido!",
"profile_rules_password_r" => "¡El campo de contraseña es obligatorio!",
"profile_rules_password_m" => "¡La contraseña debe tener al menos 8 caracteres!",
"profile_rules_password_confirm_m" => "El campo de contraseña es diferente del campo de confirmación de contraseña.",
// ACTIVITY - form
"activity_title" => "Actividades",
"activity_subtitle" => "Actividades de Acceso",
"activity_grid_user" => "Usuario",
"activity_grid_level" => "Alerta",
"activity_grid_event" => "Evento",
"activity_grid_ip" => "IP",
"activity_grid_os" => "Sistema",
"activity_grid_browser" => "Navegador",
"activity_grid_created" => "Creado En",
"activity_alert_information" => "Información",
"activity_alert_throttling" => "Intento de Acceso",
"activity_alert_recovery" => "Recuperación de Contraseña",
"activity_alert_error" => "Error",
"activity_alert_login_auth" => "Autenticación",
"activity_top_windows" => "Windows",
"activity_top_mac" => "Apple OS",
"activity_top_linux" => "Linux",
"activity_top_mobile" => "Android / IOS",
"activity_top_chrome" => "Chrome",
"activity_top_firefox" => "FireFox",
"activity_top_safari" => "Safari",
"activity_top_edge" => "EDGE / IE",
"activity_all_btn" => "Ver todo",
// USER - index
"user_title" => "Usuarios",
"user_subtitle" => "Lista de Usuarios",
"user_btn_add" => "Agregar Nuevo",
"user_btn_edit" => "Editar",
"user_btn_delete" => "Borrar",
"user_grid_name" => "Nombre",
"user_grid_email" => "Correo Electrónico",
"user_grid_group" => "Grupo",
"user_grid_last_access" => "Último Acceso",
"user_grid_last_ip" => "Último IP",
"user_grid_created" => "Fecha de Creacion",
"user_grid_options" => "Opciones",
"user_delete_title" => "¿Estas seguro que quieres borrarlo?",
"user_delete_subtitle" => "¡No podrá recuperar esta información!",
"user_delete_btn_ok" => "¡Sí, Eliminar!",
"user_delete_btn_cancel" => "Cancelar",
"user_alert_add" => "¡Agregado exitosamente!",
"user_alert_edit" => "¡Editado con éxito!",
"user_alert_delete" => "¡Eliminado con éxito!",
// USER - form
"user_add_title" => "Nuevo Usuario",
"user_add_subtitle" => "Agregar Nuevos Usuario",
"user_edit_title" => "Editar Usuario",
"user_edit_subtitle" => "Editar Usuario",
"user_field_first_name" => "Nombre",
"user_field_first_name_ph" => "Escriba su nombre",
"user_field_last_name" => "Apellido",
"user_field_last_name_ph" => "Escriba su apellido",
"user_field_email" => "Correo Electrónico",
"user_field_email_ph" => "Escriba su correo electrónico",
"user_field_cell" => "Teléfono Móvil",
"user_field_cell_ph" => "Escriba su número de celular",
"user_field_group" => "Grupo de Permisos",
"user_field_password" => "Cambiar Contraseña",
"user_field_password_ph" => "Escribe tu contraseña",
"user_field_password_confirm" => "Confirmar seña",
"user_field_password_confirm_ph" => "Confirma tu contraseña anterior",
"user_field_status" => "Situación Registro",
"user_field_date_birth" => "Fecha de Nacimiento",
"user_field_date_birth_ph" => "Seleccionar fecha de nacimiento",
"user_field_address" => "Dirección",
"user_field_address_ph" => "Escriba su dirección",
"user_field_city" => "Ciudad",
"user_field_city_ph" => "Escriba su ciudad",
"user_field_state" => "Estado",
"user_field_state_ph" => "Escriba su estado",
"user_field_country" => "País",
"user_field_zip_code" => "Código Postal",
"user_field_zip_code_ph" => "Escriba su código postal",
"user_field_language" => "Idioma",
"user_msg_desc_1" => "Defina la información del usuario a continuación:",
"user_msg_desc_2" => "Defina la información de ubicación del usuario a continuación:",
"user_grid_mobile" => "Móvil",
"user_field_email_confirmed" => "Estado del correo electrónico",
"user_alert_confirmed" => "Confirmado",
"user_alert_not_confirmed" => "No confirmado",
"user_alert_email_confirmed" => "Confirme su correo electrónico",
// USER - rules
"user_rules_first_name_r" => "¡El campo de nombre es obligatorio!",
"user_rules_last_name_r" => "¡El campo de apellido es obligatorio!",
"user_rules_email_r" => "¡El campo de correo electrónico es obligatorio!",
"user_rules_email_i" => "¡El correo electrónico {value} ya ha sido registrado!",
"user_rules_email_v" => "¡El correo electrónico debe ser válido!",
"user_rules_password_r" => "¡El campo de contraseña es obligatorio!",
"user_rules_password_m" => "¡La contraseña debe tener al menos 8 caracteres!",
"user_rules_password_confirm_m" => "El campo de contraseña es diferente del campo de confirmación de contraseña.",
// GROUP - index
"group_title" => "Grupo de Permisos",
"group_subtitle" => "Lista de Grupos de Permisos",
"group_btn_add" => "Agregar nuevo",
"group_btn_edit" => "Editar",
"group_btn_delete" => "Borrar",
"group_grid_title" => "Título",
"group_grid_dashboard" => "Panel",
"group_grid_created" => "Fecha de Creacion",
"group_grid_updated" => "Fecha Actualizada",
"group_grid_options" => "Opciones",
"group_delete_title" => "¿Estas seguro que quieres borrarlo?",
"group_delete_subtitle" => "¡No podrá recuperar esta información!",
"group_delete_btn_ok" => "¡Sí, Eliminar!",
"group_delete_btn_cancel" => "Cancelar",
"group_alert_add" => "¡Agregado exitosamente!",
"group_alert_edit" => "¡Editado con éxito!",
"group_alert_delete" => "¡Eliminado con éxito!",
"group_alert_error" => "¡Tiene usuarios vinculados a este grupo!",
// GROUP - form
"group_add_title" => "Nuevo Grupo",
"group_add_subtitle" => "Agregar Nuevo Grupo de Permisos",
"group_edit_title" => "Editar Grupo",
"group_edit_subtitle" => "Editar Grupo de Permisos",
"group_field_title" => "Nombre del Grupo",
"group_field_dashboard" => "Panel (Gescripción General)",
"group_btn_select" => "Seleccionar Todo",
"group_btn_remove" => "Eliminar Todo",
"group_label_user" => "Usuario",
"group_label_admin" => "Administrador",
// GROUP - rules
"group_rules_title_r" => "¡El campo del nombre del grupo es obligatorio!",
"group_rules_dashboard_r" => "¡El campo del panel es obligatorio!",
// GROUP - Rules Name
"group_rules_label_group" => "Permiso de grupo",
"group_rules_label_user" => "Usuario",
"group_rules_label_settings" => "Configuración",
"group_rules_label_index" => "Lista",
"group_rules_label_add" => "Agregar",
"group_rules_label_edit" => "Editar",
"group_rules_label_delete" => "Eliminar",
"group_rules_label_store" => "Guardar",
"group_rules_label_oauth" => "Autenticaciones",
"group_rules_label_template" => "Plantillas",
"group_rules_label_all" => "Ver todo",
"group_rules_label_my" => "Mis notificaciones",
"group_rules_label_view" => "Ver notificación",
"group_rules_label_oauth_store" => "Guardar oAuth",
"group_rules_label_template_store" => "Guardar plantillas",
// AUTH - index
"oauth_title" => "Autenticación oAuth",
"oauth_subtitle" => "Configuración de autenticación de redes sociales",
"oauth_label_id" => "ID de la Cuenta",
"oauth_label_id_ph" => "Escriba su id de la cuenta",
"oauth_label_key" => "Key de la Cuenta",
"oauth_label_key_ph" => "Escriba su key de la cuenta",
"oauth_label_secret" => "Llave Secreta",
"oauth_label_secret_ph" => "Escriba su llave secreta",
"oauth_label_view" => "Mostrar texto",
"oauth_label_active" => "Activar red social",
"oauth_alert_add" => "¡Guardado exitosamente!",
"oauth_alert_error" => "¡Error al guardar!",
// TEMPLATE - index
"template_title" => "Plantillas",
"template_subtitle" => "Configuración de Plantilla",
"template_subtitle_email" => "Plantillas de Correo Electrónico",
"template_label_title" => "Título",
"template_label_title_ph" => "Escriba su título",
"template_label_message" => "Mensaje",
"template_label_forgot_pass" => "Olvido la contraseña",
"template_label_welcome" => "Bienvenida",
"template_label_tfa" => "Autenticación de dos factores (2FA)",
"template_label_tag" => "Ver palabras clave",
"template_alert_add" => "¡Guardado exitosamente!",
"template_alert_error" => "¡Error al guardar!",
"template_modal_title" => "Palabras Clave",
"template_modal_subtitle" => "A continuación, se muestran algunas palabras clave que se pueden incorporar al texto:",
"template_modal_btn_1" => "Cerrar",
"template_modal_copy" => "Copiado!",
"template_modal_copy_msg" => "¡Copiado con éxito!",
"template_label_confirmation_email" => "Confirmación por correo electrónico",
"template_label_notification" => "Notificación de cuentas nuevas",
// SETTINGS - index
"settings_title" => "Configuración",
"settings_subtitle" => "Configuración general",
"settings_label_general" => "General",
"settings_label_general_title" => "Configuración general",
"settings_label_general_subtitle_1" => "Establecer la configuración de la página a continuación:",
"settings_label_general_subtitle_2" => "Establezca la configuración inicial predeterminada a continuación:",
"settings_label_email" => "Correo electrónico",
"settings_label_email_title" => "Configuración de correo electrónico",
"settings_label_email_subtitle_1" => "Establezca la configuración de envío de correo electrónico a continuación:",
"settings_label_captcha" => "Captcha",
"settings_label_captcha_title" => "Configuración de Captcha",
"settings_label_captcha_subtitle_1" => "Establezca la configuración de uso del captcha a continuación:",
"settings_label_captcha_subtitle_2" => "Establezca la ubicación de visualización del captcha a continuación:",
"settings_label_auth" => "Autenticación",
"settings_label_auth_title" => "Configuración de autenticación",
"settings_label_auth_subtitle_1" => "Defina a continuación si desea habilitar la autenticación de dos factores:",
"settings_label_auth_subtitle_2" => "Defina a continuación si desea bloquear los intentos de acceso:",
"settings_label_storage" => "Almacenamiento",
"settings_label_storage_title" => "Configuración de almacenamiento",
"settings_label_storage_subtitle_1" => "Configure la puerta de enlace de almacenamiento predeterminada a continuación:",
"settings_label_storage_subtitle_2" => "Configure los ajustes para el almacenamiento en Amazon S3 o MiniIO a continuación:",
"settings_label_backup" => "Copia de seguridad de MySql",
"settings_label_backup_title" => "Configuración de copia de seguridad de datos",
"settings_label_backup_subtitle_1" => "Establezca la configuración de copia de seguridad a continuación:",
"settings_label_backup_btn_1" => "Generar y descargar copia de seguridad",
"settings_label_register" => "Registros",
"settings_label_register_title" => "Configuración de registro e inicio de sesión",
"settings_label_register_subtitle_1" => "Establezca la configuración de registro e inicio de sesión para los nuevos usuarios a continuación:",
"settings_label_notification" => "Notificaciones",
"settings_label_notification_title" => "Configuración de notificaciones",
"settings_label_notification_subtitle_1" => "Establezca a continuación si desea recibir notificaciones de nuevos usuarios por:",
"settings_label_api" => "API",
"settings_label_api_title" => "Configuración de API",
"settings_label_api_subtitle_1" => "Establezca a continuación si desea habilitar el uso de API:",
"settings_label_logs" => "Registros",
"settings_label_logs_title" => "Configuración de registros",
"settings_label_logs_subtitle_1" => "Defina a continuación si desea borrar los registros de acceso con frecuencia:",
"settings_field_title" => "Título de la página",
"settings_field_title_ph" => "Ingrese el título de la página",
"settings_field_logo" => "",
"settings_field_icon" => "",
"settings_field_default_language" => "Idioma",
"settings_field_default_role" => "Permiso de usuario de grupo",
"settings_field_default_date_format" => "Formato de fecha",
"settings_field_default_hour_format" => "Formato de hora",
"settings_field_default_currency" => "Moneda",
"settings_field_default_currency_position" => "Símbolo de moneda",
"settings_field_default_currency_position_left" => "Izquierda",
"settings_field_default_currency_position_right" => "A la derecha",
"settings_field_default_currency_separation" => "Separación de divisas",
"settings_field_default_currency_separation_dot" => "Por punto 0.00",
"settings_field_default_currency_separation_coma" => "Por coma 0.00",
"settings_field_default_country" => "País",
"settings_field_default_theme" => "Diseño Backend",
"settings_field_default_theme_front" => "Diseño Frontend",
"settings_field_frontend" => "Activar Frontend",
"settings_field_default_timezone" => "Zona horaria",
"settings_field_seo_description" => "Descripción (SEO)",
"settings_field_seo_keywords" => "Palabras clave (SEO)",
"settings_field_test_send" => "Realice un envío de prueba para verificar que la configuración anterior sea correcta.",
"settings_field_test_send_btn" => "Mandar",
"settings_field_email_gateway" => "Puerta de enlace de correo electrónico",
"settings_field_email_gateway_smtp" => "SMTP",
"settings_field_email_name" => "Nombre en el correo electrónico",
"settings_field_email_name_ph" => "Ingrese el nombre en el correo electrónico",
"settings_field_email_address" => "Dirección de correo electrónico",
"settings_field_email_address_ph" => "Ingrese la dirección de correo electrónico",
"settings_field_email_smtp" => "Servidor (Host)",
"settings_field_email_smtp_ph" => "Ingrese la dirección del host",
"settings_field_email_port" => "Puerto (Host)",
"settings_field_email_port_ph" => "Ingrese el puerto de host",
"settings_field_email_pass" => "Contraseña de correo electrónico",
"settings_field_email_pass_ph" => "Ingrese la contraseña de correo electrónico",
"settings_field_email_cert" => "Autenticación",
"settings_field_email_cert_none" => "Ninguno",
"settings_field_email_cert_ssl" => "SSL",
"settings_field_email_cert_tls" => "TLS",
"settings_field_email_account_id" => "ID de cuenta",
"settings_field_email_account_id_ph" => "Ingresar ID de cuenta",
"settings_field_email_auth_token" => "Token Auth",
"settings_field_email_auth_token_ph" => "Ingrese el token de autenticación",
"settings_field_email_info_add" => "Información adicional",
"settings_field_email_info_add_ph" => "Ingresar información",
"settings_field_captcha_gateway" => "Gateway Captcha",
"settings_field_captcha_gateway_recaptcha" => "reCaptcha",
"settings_field_captcha_gateway_hcaptcha" => "hCaptcha",
"settings_field_captcha_site_key" => "Clave del sitio",
"settings_field_captcha_site_key_ph" => "Ingrese la clave del sitio",
"settings_field_captcha_secret_key" => "Clave secreta",
"settings_field_captcha_secret_key_ph" => "Ingresar clave secreta",
"settings_field_captcha_register" => "Pantalla de registro",
"settings_field_captcha_login" => "Pantalla de inicio de sesión",
"settings_field_captcha_recovery" => "Pantalla de rec. de contraseña",
"settings_field_registration" => "Pantalla de registro",
"settings_field_terms_conditions" => "Términos y condiciones",
"settings_field_terms_conditions_text" => "Términos y condiciones",
"settings_field_email_confirmation" => "Confirmación por correo electrónico",
"settings_field_send_welcome_message" => "Correo electrónico de bienvenida",
"settings_field_remember_me" => "Recuérdame",
"settings_field_forgot_password" => "Olvidé mi contraseña",
"settings_field_send_email_register" => "Correo electrónico",
"settings_field_send_notification_register" => "Notificación del panel",
"settings_field_two_factor_auth" => "Dos factores (2FA)",
"settings_field_throttle_auth" => "Autenticación de intentos",
"settings_field_throttle_auth_max_attempts" => "Número de intentos",
"settings_field_throttle_auth_max_attempts_ph" => "Ingrese el número de intentos",
"settings_field_throttle_auth_lockour_time" => "Tiempo de bloqueo",
"settings_field_throttle_auth_lockour_time_ph" => "Ingresar intervalo de tiempo",
"settings_field_jwt_token_lifetime" => "JWT Token Time",
"settings_field_jwt_token_lifetime_ph" => "Ingrese el tiempo de renovación del token",
"settings_field_jwt_private_key" => "Clave privada JWT",
"settings_field_jwt_private_key_ph" => "Ingresar clave privada",
"settings_field_enable_api" => "API RestFul",
"settings_field_remove_log" => "Eliminar registros",
"settings_field_remove_log_time" => "Borrar cada",
"settings_field_remove_log_time_ph" => "Ingrese el número de días para borrar",
"settings_field_remove_log_last_date" => "Última limpieza",
"settings_field_storage_gateway" => "Storage Gateway",
"settings_field_storage_gateway_local" => "Local",
"settings_field_storage_gateway_aws" => "Amazon S3",
"settings_field_storage_gateway_minio" => "MinIO",
"settings_field_backup_storage" => "Almacenamiento",
"settings_field_backup_table" => "Tabla",
"settings_field_backup_table_all" => "Todo",
"settings_field_backup_table_user" => "Usuarios",
"settings_field_backup_table_settings" => "Configuración",
"settings_field_backup_email" => "Notificación por correo electrónico",
"settings_field_backup_email_ph" => "Ingrese el correo electrónico de notificación",
"settings_field_backup_notification_email" => "Notificar por correo electrónico",
"settings_field_backup_automatic" => "Copia de seguridad automática (Cron)",
"settings_field_backup_time" => "Hora",
"settings_alert_add" => "¡Guardado con éxito!",
"settings_alert_error" => "¡Error al guardar!",
"settings_label_cron" => "Tareas de Cron",
"settings_label_cron_title" => "Configuración de tareas de Cron",
"settings_label_cron_subtitle_1" => "A continuación se muestra cómo configurar las tareas cron en su alojamiento.",
"settings_label_cron_subtitle_2" => "Los últimos registros de errores en crontab se enumeran a continuación.",
"settings_label_cron_timer" => "Temporizador CronTab:",
"settings_label_cron_timer_time" => "Cada 5 minutos (* / 5 * * * *)",
"settings_field_aws_endpoint" => "punto final (MinIO)",
"settings_field_aws_endpoint_ph" => "Ingrese el punto final para MinIO",
"settings_field_aws_key" => "Clave",
"settings_field_aws_key_ph" => "Introducir clave",
"settings_field_aws_secret" => "Clave secreta",
"settings_field_aws_secret_ph" => "Ingresar clave secreta",
"settings_field_aws_region" => "Región",
"settings_field_aws_region_ph" => "Ingresar región",
"settings_field_aws_bucket" => "Cubo",
"settings_field_aws_bucket_ph" => "Nombre del depósito",
"settings_field_send_user_register" => "Usuario que recibirá notificaciones",
"settings_label_api_subtitle_2" => "A continuación se enumeran todas las llamadas a APIRest.",
"settings_label_api_users" => "Usuarios",
"settings_label_api_auth" => "Servicio de autenticación y estado",
"settings_label_api_download" => "Descargar Colección Postman",
"settings_field_group_api" => "Acceso grupal permitido",
"settings_field_block_api" => "Bloquear acceso externo",
"settings_field_ip_api" => "Dirección IP permitida",
"settings_field_ip_api_ph" => "Establezca una dirección IP si establece un bloqueo externo.",
"settings_grid_routine" => "Rutina Cron",
"settings_group_grid_error" => "Mensaje de error",
"settings_group_grid_created_at" => "Fecha de registro",
"settings_alert_email_test_send" => "Enviado con exito!",
"settings_alert_email_test_error" => "¡Error al enviar!",
// NOTIFICATION - index
"notification_title" => "Notificaciones",
"notification_subtitle" => "Lista de notificaciones",
"notification_btn_add" => "Agregar nuevo",
"notification_btn_edit" => "Editar",
"notification_btn_delete" => "Eliminar",
"notification_grid_sender" => "Remitente",
"notification_grid_recipient" => "Destinatario",
"notification_grid_title" => "Título",
"notification_grid_dashboard" => "Panel de control",
"notification_grid_created" => "Fecha de creación",
"notification_grid_updated" => "Fecha de actualización",
"notification_grid_email" => "¿Correo electrónico enviado?",
"notification_grid_view" => "¿Leer?",
"notification_grid_options" => "Opciones",
"notification_grid_yes" => "",
"notification_grid_no" => "No",
"notification_delete_title" => "¿Estás seguro de que deseas eliminar?",
"notification_delete_subtitle" => "¡No podrás recuperar esta información!",
"notification_delete_btn_ok" => "¡Sí, eliminar!",
"notification_delete_btn_cancel" => "Cancelar",
"notification_alert_add" => "¡Agregado exitosamente!",
"notification_alert_edit" => "¡Editado correctamente!",
"notification_alert_delete" => "¡Eliminado correctamente!",
// NOTIFICATION - form
"notification_add_title" => "Nueva notificación",
"notification_add_subtitle" => "Agregar nueva notificación",
"notification_edit_title" => "Editar notificación",
"notification_edit_subtitle" => "Editar notificación",
"notification_field_title" => "Título",
"notification_field_title_ph" => "Ingrese el título",
"notification_field_user" => "Usuario",
"notification_field_user_all" => "Todos",
"notification_field_body" => "Mensaje",
"notification_field_send_msg" => "¿Quieres enviar la notificación también por:",
"notification_field_send_email" => "¿Enviar por correo electrónico?",
"notification_field_send_label" => "Enviar",
// NOTIFICATION - rules
"notification_rules_title_r" => "¡El campo de título es obligatorio!",
"notification_rules_body_r" => "¡El campo de mensaje es obligatorio!",
// NOTIFICATION - Bell Header
"notification_title_my" => "Mis notificaciones",
"notification_subtitle_my" => "Lista de notificaciones",
"notification_subtitle_view" => "Ver mi notificación",
"notification_bell_btn" => "Ver todas las notificaciones",
"notification_view_btn" => "Ver",
"notification_grid_view_my" => "Visto",
"notification_grid_created_my" => "Recibido",
// CronTab and Demo Mode
"crontab_backup_success" => "Copia de seguridad generada correctamente en:",
"crontab_backup_error" => "¡Error al generar la copia de seguridad!",
"crontab_email_error" => "Se produjo un error al intentar enviar un correo electrónico.",
"general_demo_mode" => "¡Sistema en modo de demostración!",
// v1.2.1
"global_select" => "Selecciona un artículo",
];

View File

@ -0,0 +1,4 @@
<?php
// override core en language system validation or define your own en language validation message
return [];

602
ci4/app/Language/pt/App.php Normal file
View File

@ -0,0 +1,602 @@
<?php
return [
// MENUS
"menu_dashboard" => "Painel",
"menu_registration" => "Cadastro",
"menu_users" => "Usuários",
"menu_permission_group" => "Grupo Permissão",
"menu_settings" => "Configurações",
"menu_general" => "Gerais",
"menu_logout" => "Sair",
"menu_profile" => "Meu Perfil",
"menu_activity" => "Atividades",
"menu_notification" => "Notificações",
"menu_list" => "Listar",
"menu_add" => "Adicionar",
"menu_oauth" => "Autenticações",
"menu_template" => "Modelos",
// LANGUAGES
"lang_en" => "Inglês",
"lang_es" => "Espanhol",
"lang_pt" => "Português",
// GLOBAL
"global_minute" => "Minuto",
"global_minutes" => "Minutos",
"global_hour" => "Hora",
"global_hours" => "Horas",
"global_day" => "Dia",
"global_days" => "Dias",
"global_week" => "Semana",
"global_weeks" => "Semanas",
"global_month" => "Mês",
"global_months" => "Meses",
"global_come_back" => "Voltar",
"global_save" => "Salvar",
"global_alert_save_success" => "Salvo com sucesso!",
"global_alert_save_error" => "Erro ao salvar!",
"global_activate" => "Ativar",
"global_disable" => "Desativar",
"global_active" => "Ativo",
"global_inactive" => "Inativo",
"global_copy" => "Copiar",
"global_print" => "Imprimir",
"global_excel" => "Excel",
"global_pdf" => "PDF",
// LOGIN - index
"login_title" => "Faça login na sua conta",
"login_email" => "E-mail",
"login_email_ph" => "Digite seu e-mail",
"login_password" => "Senha",
"login_password_ph" => "Digite sua senha",
"login_remember_me" => "Lembrar-me",
"login_forgot_password" => "Esqueci a Senha",
"login_access" => "Entrar",
"login_signup" => "Inscrever-se",
"login_signup_desc" => "Ainda não tem conta?",
// LOGIN - forgot_password
"login_title_forgot_password" => "Recuperar Senha",
"login_request" => "Solicitar",
"login_come_back" => "Voltar",
"login_wait" => "Aguarde...",
// LOGIN - authentication
"login_title_otp" => "Autenticação 2FA",
"login_otp_code" => "Código OTP",
"login_otp_span" => "Abra o Google Authenticator e digite o código gerado abaixo:",
// LOGIN - recovery
"login_title_recovery" => "Nova Senha",
"login_new_password" => "Nova Senha",
"login_btn_recovery" => "Alterar Senha",
// LOGIN - signup
"login_title_signup" => "Nova Conta",
"login_first_name" => "Nome",
"login_first_name_ph" => "Digite seu nome",
"login_last_name" => "Sobrenome",
"login_last_name_ph" => "Digite seu sobrenome",
"login_accept_terms" => "Aceito os termos",
"login_read_terms" => "Ler os termos",
"login_terms_use" => "Termos de Uso",
"login_accept" => "Aceito",
"login_closed" => "Fechar",
"login_register" => "Cadastrar",
// LOGIN - notification
"login_alert" => "Atenção!",
"login_alert_success" => "Parabéns!",
"login_alert_send" => "Enviado!",
"login_alert_terms" => "Precisa aceitar os termos.",
"login_alert_captcha_invalid" => "Código do captcha é inválido.",
"login_alert_captcha_not_found" => "Captcha não encontrado.",
"login_alert_user_blocked" => "Usuário bloqueado temporariamente por ",
"login_alert_pass_invalid" => "Senha inválida.",
"login_alert_pass_invalid_2" => "Senha inválida, ",
"login_alert_pass_attempt" => " tentiva de ",
"login_alert_disabled_access" => "Acesso temporariamente desativado.",
"login_alert_user_not_found" => "Usuário não encontrado.",
"login_alert_code_invalid" => "Código é inválido.",
"login_alert_parameter_invalid" => "Parâmentro inválido.",
"login_alert_success_register" => "Cadastro efetuado com sucesso!",
"login_alert_success_recovery" => "Senha alterada com sucesso!",
"login_alert_send_pass" => "Link de recuperação de senha, enviado por e-mail.",
"login_alert_error_email" => "Erro ao tentar enviar e-mail.",
"login_alert_error_pass" => "Erro ao tentar recuperar senha.",
"login_alert_empty_token" => "Token ausente!",
"login_alert_invalid_token" => "Token inválido!",
"login_alert_success_confirmation" => "Confirmado com sucesso!",
// LOGIN - rules
"login_rules_first_name_r" => "O campo nome é obrigatório!",
"login_rules_last_name_r" => "O campo sobrenome é obrigatório!",
"login_rules_email_r" => "O campo e-mail é obrigatório!",
"login_rules_email_i" => "O e-mail {value} já foi cadastrado!",
"login_rules_email_v" => "O e-mail precisa ser válido!",
"login_rules_password_r" => "O campo Senha é obrigatório!",
"login_rules_password_m" => "A senha deve possuir no mínimo 8 caracteres!",
// DASHBOARD - admin
"dashboard_title" => "Painel",
"dashboard_user_total" => "Geral",
"dashboard_user_new" => "Novos",
"dashboard_user_enabled" => "Ativos",
"dashboard_user_disabled" => "Inativos",
"dashboard_grid_user" => "Últimos Registros",
"dashboard_grid_access" => "Últimos Acessos",
"dashboard_chart_history" => "Histórico Registro",
"dashboard_chart_months" => "Jan, Fev, Mar, Abr, Mai, Jun, Jul, Ago, Set, Out, Nov, Dez",
"dashboard_hello" => "Olá, ",
"dashboard_good_morning" => "bom dia",
"dashboard_good_afternoon" => "bom tarde",
"dashboard_good_night" => "boa noite",
"dashboard_indicators" => "Veja abaixo alguns indicadores para hoje!",
"dashboard_user" => "Usuário",
"dashboard_email" => "E-mail",
"dashboard_created_at" => "Último Acesso",
"dashboard_alert_rules" => "Acesso negado!<br>Não possui permissão",
// PROFILE - form
"profile_title" => "Meu Perfil",
"profile_subtitle" => "Minhas Informações",
"profile_subtitle_image" => "Imagem Perfil",
"profile_subtitle_tfa" => "Autenticação Dois Fatores (2FA)",
"profile_first_name" => "Nome",
"profile_first_name_ph" => "Digite seu nome",
"profile_last_name" => "Sobrenome",
"profile_last_name_ph" => "Digite seu sobrenome",
"profile_email" => "E-mail",
"profile_email_ph" => "Digite seu e-mail",
"profile_mobile" => "Tel. Celular",
"profile_mobile_ph" => "Digite um nº de celular",
"profile_password" => "Alterar Senha",
"profile_password_ph" => "Digite sua senha",
"profile_confirm_password" => "Confirmar Senha",
"profile_confirm_password_ph" => "Confirme sua senha anterior",
"profile_date_birth" => "Data Nascimento",
"profile_date_birth_ph" => "Selecione a data nascimento",
"profile_address" => "Endereço",
"profile_address_ph" => "Digite seu endereço",
"profile_city" => "Cidade",
"profile_city_ph" => "Digite sua cidade",
"profile_state" => "Estado",
"profile_state_ph" => "Digite seu estado",
"profile_country" => "País",
"profile_zip_code" => "CEP",
"profile_zip_code_ph" => "Digite seu CEP",
"profile_language" => "Idioma",
"profile_msg_desc_1" => "Defina abaixo suas informações:",
"profile_msg_desc_2" => "Defina abaixo sua localidade:",
"profile_change_photo" => "Alterar Foto",
"profile_qrcode" => "Google Authenticator QRCode:",
"profile_backup_code" => "Códigos de Backup:",
"profile_change_image" => "Escolha uma das opções abaixo:",
"profile_upload_msg" => "Carregar",
"profile_no_image_msg" => "Sem Foto",
"profile_gravatar_msg" => "Gravatar",
"profile_tfa_msg" => "Usar Autenticação 2FA",
"profile_tfa_secret" => "Chave Secreta:",
"profile_tfa_download" => "Baixar Informações",
// PROFILE - rules
"profile_rules_first_name_r" => "O campo nome é obrigatório!",
"profile_rules_last_name_r" => "O campo sobrenome é obrigatório!",
"profile_rules_email_r" => "O campo e-mail é obrigatório!",
"profile_rules_email_i" => "O e-mail {value} já foi cadastrado!",
"profile_rules_email_v" => "O e-mail precisa ser válido!",
"profile_rules_password_r" => "O campo Senha é obrigatório!",
"profile_rules_password_m" => "A senha deve possuir no mínimo 8 caracteres!",
"profile_rules_password_confirm_m" => "O campo senha está diferente do campo confirmar senha.",
// ACTIVITY - form
"activity_title" => "Atividades",
"activity_subtitle" => "Atividades de Acessos",
"activity_grid_user" => "Usuário",
"activity_grid_level" => "Alerta",
"activity_grid_event" => "Evento",
"activity_grid_ip" => "IP",
"activity_grid_os" => "Sistema",
"activity_grid_browser" => "Navegador",
"activity_grid_created" => "Criado Em",
"activity_alert_information" => "Informação",
"activity_alert_throttling" => "Tentativa de Acesso",
"activity_alert_recovery" => "Recuperação de Senha",
"activity_alert_error" => "Erro",
"activity_alert_login_auth" => "Autenticação",
"activity_top_windows" => "Windows",
"activity_top_mac" => "Apple OS",
"activity_top_linux" => "Linux",
"activity_top_mobile" => "Android / IOS",
"activity_top_chrome" => "Chrome",
"activity_top_firefox" => "FireFox",
"activity_top_safari" => "Safari",
"activity_top_edge" => "EDGE / IE",
"activity_all_btn" => "Visualizar Todos",
// USER - index
"user_title" => "Usuários",
"user_subtitle" => "Lista de Usuários",
"user_btn_add" => "Adicionar Novo",
"user_btn_edit" => "Editar",
"user_btn_delete" => "Deletar",
"user_grid_name" => "Nome",
"user_grid_email" => "E-mail",
"user_grid_group" => "Grupo",
"user_grid_last_access" => "Último Acesso",
"user_grid_last_ip" => "Último IP",
"user_grid_created" => "Data Criado",
"user_grid_options" => "Opções",
"user_delete_title" => "Certeza que deseja deletar?",
"user_delete_subtitle" => "Você não conseguirá recuperar essa informação!",
"user_delete_btn_ok" => "Sim, Deletar!",
"user_delete_btn_cancel" => "Cancelar",
"user_alert_add" => "Adicionado com sucesso!",
"user_alert_edit" => "Editado com sucesso!",
"user_alert_delete" => "Deletado com sucesso!",
// USER - form
"user_add_title" => "Novo Usuário",
"user_add_subtitle" => "Adicionar Novo Usuários",
"user_edit_title" => "Editar Usuário",
"user_edit_subtitle" => "Editar Usuário",
"user_field_first_name" => "Nome",
"user_field_first_name_ph" => "Digite seu nome",
"user_field_last_name" => "Sobrenome",
"user_field_last_name_ph" => "Digite seu sobrenome",
"user_field_email" => "E-mail",
"user_field_email_ph" => "Digite seu e-mail",
"user_field_cell" => "Tel. Celular",
"user_field_cell_ph" => "Digite seu nº de celular",
"user_field_group" => "Grupo de Permissões",
"user_field_password" => "Senha",
"user_field_password_ph" => "Digite sua senha",
"user_field_password_confirm" => "Confirmar Senha",
"user_field_password_confirm_ph" => "Digite a senha anterior",
"user_field_status" => "Situação Cadastro",
"user_field_date_birth" => "Data Nascimento",
"user_field_date_birth_ph" => "Selecione a data nascimento",
"user_field_address" => "Endereço",
"user_field_address_ph" => "Digite seu endereço",
"user_field_city" => "Cidade",
"user_field_city_ph" => "Digite sua cidade",
"user_field_state" => "Estado",
"user_field_state_ph" => "Digite seu estado",
"user_field_country" => "País",
"user_field_zip_code" => "CEP",
"user_field_zip_code_ph" => "Digite seu CEP",
"user_field_language" => "Idioma",
"user_msg_desc_1" => "Defina abaixo as informações do usuário:",
"user_msg_desc_2" => "Defina abaixo as informações da localidade do usuário:",
"user_grid_mobile" => "Celular",
"user_field_email_confirmed" => "Situação E-mail",
"user_alert_confirmed" => "Confirmado",
"user_alert_not_confirmed" => "Não Confirmado",
"user_alert_email_confirmed" => "Por favor confirme seu e-mail.",
// USER - rules
"user_rules_first_name_r" => "O campo nome é obrigatório!",
"user_rules_last_name_r" => "O campo sobrenome é obrigatório!",
"user_rules_email_r" => "O campo e-mail é obrigatório!",
"user_rules_email_i" => "O e-mail {value} já foi cadastrado!",
"user_rules_email_v" => "O e-mail precisa ser válido!",
"user_rules_password_r" => "O campo Senha é obrigatório!",
"user_rules_password_m" => "A senha deve possuir no mínimo 8 caracteres!",
"user_rules_password_confirm_m" => "O campo senha está diferente do campo confirmar senha.",
// GROUP - index
"group_title" => "Grupo Permissão",
"group_subtitle" => "Lista de Grupo Permissões",
"group_btn_add" => "Adicionar Novo",
"group_btn_edit" => "Editar",
"group_btn_delete" => "Deletar",
"group_grid_title" => "Título",
"group_grid_dashboard" => "Painel",
"group_grid_created" => "Data Criado",
"group_grid_updated" => "Data Atualizado",
"group_grid_options" => "Opções",
"group_delete_title" => "Certeza que deseja deletar?",
"group_delete_subtitle" => "Você não conseguirá recuperar essa informação!",
"group_delete_btn_ok" => "Sim, Deletar!",
"group_delete_btn_cancel" => "Cancelar",
"group_alert_add" => "Adicionado com sucesso!",
"group_alert_edit" => "Editado com sucesso!",
"group_alert_delete" => "Deletado com sucesso!",
"group_alert_error" => "Possui usúarios vinculado a esse grupo!",
// GROUP - form
"group_add_title" => "Novo Grupo",
"group_add_subtitle" => "Adicionar Novo Grupo de Permissão",
"group_edit_title" => "Editar Grupo",
"group_edit_subtitle" => "Editar Grupo de Permissão",
"group_field_title" => "Nome do Grupo",
"group_field_dashboard" => "Painel (Visão Geral)",
"group_btn_select" => "Selecionar Todos",
"group_btn_remove" => "Remover Todos",
"group_label_user" => "Usuário",
"group_label_admin" => "Administrador",
// GROUP - rules
"group_rules_title_r" => "O campo nome do grupo é obrigatório!",
"group_rules_dashboard_r" => "O campo painel é obrigatório!",
// GROUP - Rules Name
"group_rules_label_group" => "Grupo Permissão",
"group_rules_label_user" => "Usuário",
"group_rules_label_settings" => "Configuração",
"group_rules_label_index" => "Listar",
"group_rules_label_add" => "Adicionar",
"group_rules_label_edit" => "Editar",
"group_rules_label_delete" => "Deletar",
"group_rules_label_store" => "Salvar",
"group_rules_label_oauth" => "Autenticações",
"group_rules_label_template" => "Modelos",
"group_rules_label_all" => "Ver Todos",
"group_rules_label_my" => "Minhas Notificações",
"group_rules_label_view" => "Ver Notificação",
"group_rules_label_oauth_store" => "Salvar oAuth",
"group_rules_label_template_store" => "Salvar Modelos",
// AUTH - index
"oauth_title" => "Autenticação oAuth",
"oauth_subtitle" => "Configurações Autenticação de Rede Social",
"oauth_label_id" => "ID da Conta",
"oauth_label_id_ph" => "Digite o id da conta",
"oauth_label_key" => "Key da Conta",
"oauth_label_key_ph" => "Digite a key da conta",
"oauth_label_secret" => "Chave Secreta",
"oauth_label_secret_ph" => "Digite a chave secreta",
"oauth_label_view" => "Exibir Texto",
"oauth_label_active" => "Ativar Rede Social",
"oauth_alert_add" => "Salvo com sucesso!",
"oauth_alert_error" => "Erro ao Salvar!",
// TEMPLATE - index
"template_title" => "Modelos",
"template_subtitle" => "Configurações de Templates",
"template_subtitle_email" => "Templates E-Mail",
"template_label_title" => "Título",
"template_label_title_ph" => "Digite o título",
"template_label_message" => "Mensagem",
"template_label_forgot_pass" => "Esqueceu a senha",
"template_label_welcome" => "Boas vindas",
"template_label_tfa" => "Autenticação dois fatores (2FA)",
"template_label_tag" => "Visualizar Palavras Chave",
"template_alert_add" => "Salvo com sucesso!",
"template_alert_error" => "Erro ao Salvar!",
"template_modal_title" => "Palavras Chave",
"template_modal_subtitle" => "Abaixo algumas palavras chaves que podem ser incorporada ao texto:",
"template_modal_btn_1" => "Fechar",
"template_modal_copy" => "Copiado!",
"template_modal_copy_msg" => "Copiado com sucesso!",
"template_label_confirmation_email" => "Confirmação de E-mail",
"template_label_notification" => "Notificação Novas Contas",
// SETTINGS - index
"settings_title" => "Configurações",
"settings_subtitle" => "Configurações Gerais",
"settings_label_general" => "Gerais",
"settings_label_general_title" => "Configurações Gerais",
"settings_label_general_subtitle_1" => "Defina abaixo as configurações da página:",
"settings_label_general_subtitle_2" => "Defina abaixo as configurações iniciais padrões:",
"settings_label_email" => "E-mail",
"settings_label_email_title" => "Configurações de E-mail",
"settings_label_email_subtitle_1" => "Defina abaixo as configurações de envio de e-mail:",
"settings_label_captcha" => "Captcha",
"settings_label_captcha_title" => "Configurações de Captcha",
"settings_label_captcha_subtitle_1" => "Defina abaixo as configurações do uso de captcha:",
"settings_label_captcha_subtitle_2" => "Defina abaixo o local de exibição do captcha:",
"settings_label_auth" => "Autenticação",
"settings_label_auth_title" => "Configurações de Autenticação",
"settings_label_auth_subtitle_1" => "Defina abaixo se deseja liberar autenticação de dois fatores:",
"settings_label_auth_subtitle_2" => "Defina abaixo se deseja bloquear tentativas de acesso:",
"settings_label_storage" => "Armazenamento",
"settings_label_storage_title" => "Configurações de Armazenamento",
"settings_label_storage_subtitle_1" => "Defina abaixo o gateway de armazenamento padrão:",
"settings_label_storage_subtitle_2" => "Defina abaixo as configurações para armazenamento no Amazon S3 ou MinIO:",
"settings_label_backup" => "Backup MySql",
"settings_label_backup_title" => "Configurações de Backups de Dados",
"settings_label_backup_subtitle_1" => "Defina abaixo as configurações de backups:",
"settings_label_backup_btn_1" => "Gerar e Baixar Backup",
"settings_label_register" => "Registros",
"settings_label_register_title" => "Configurações de Registro e Login",
"settings_label_register_subtitle_1" => "Defina abaixo as configurações de registros e login de novos usuários:",
"settings_label_notification" => "Notificações",
"settings_label_notification_title" => "Configurações de Notificações",
"settings_label_notification_subtitle_1" => "Defina abaixo se deseja receber notificações de novos usuarios por:",
"settings_label_api" => "API",
"settings_label_api_title" => "Configurações da API",
"settings_label_api_subtitle_1" => "Defina abaixo se deseja ativar uso da API:",
"settings_label_logs" => "Logs",
"settings_label_logs_title" => "Configurações de Logs",
"settings_label_logs_subtitle_1" => "Defina abaixo se deseja apagar os logs de acesso com frequência:",
"settings_field_title" => "Título da Página",
"settings_field_title_ph" => "Digite o título da página",
"settings_field_logo" => "",
"settings_field_icon" => "",
"settings_field_default_language" => "Idioma",
"settings_field_default_role" => "Grupo Permissão Usuário",
"settings_field_default_date_format" => "Formato da Data",
"settings_field_default_hour_format" => "Formato da Hora",
"settings_field_default_currency" => "Moeda",
"settings_field_default_currency_position" => "Moeda Simbolo",
"settings_field_default_currency_position_left" => "Na Esquerda",
"settings_field_default_currency_position_right" => "Na Direita",
"settings_field_default_currency_separation" => "Moeda Separação",
"settings_field_default_currency_separation_dot" => "Por Ponto 0.00",
"settings_field_default_currency_separation_coma" => "Por Virgula 0,00",
"settings_field_default_country" => "País",
"settings_field_default_theme" => "Layout Backend",
"settings_field_default_theme_front" => "Layout Frontend",
"settings_field_frontend" => "Ativar Frontend",
"settings_field_default_timezone" => "Fuso Horário",
"settings_field_seo_description" => "Descrição (SEO)",
"settings_field_seo_keywords" => "Palavras Chave (SEO)",
"settings_field_test_send" => "Faça um envio de teste para verificar se as configurações acima estão corretas.",
"settings_field_test_send_btn" => "Enviar",
"settings_field_email_gateway" => "Gateway E-mail",
"settings_field_email_gateway_smtp" => "SMTP",
"settings_field_email_name" => "Nome no E-mail",
"settings_field_email_name_ph" => "Digite o nome no e-mail",
"settings_field_email_address" => "Endereço de E-mail",
"settings_field_email_address_ph" => "Digite o endereço de e-mail",
"settings_field_email_smtp" => "Servidor (Host)",
"settings_field_email_smtp_ph" => "Digite o endereço do host",
"settings_field_email_port" => "Porta (Host)",
"settings_field_email_port_ph" => "Digite a porta do host",
"settings_field_email_pass" => "Senha do E-mail",
"settings_field_email_pass_ph" => "Digite a senha do e-mail",
"settings_field_email_cert" => "Autenticação",
"settings_field_email_cert_none" => "Nenhum",
"settings_field_email_cert_ssl" => "SSL",
"settings_field_email_cert_tls" => "TLS",
"settings_field_email_account_id" => "ID Conta",
"settings_field_email_account_id_ph" => "Digite o ID da conta",
"settings_field_email_auth_token" => "Token Auth",
"settings_field_email_auth_token_ph" => "Digite o Token de autenticação",
"settings_field_email_info_add" => "Informações Adicionais",
"settings_field_email_info_add_ph" => "Digite a informação",
"settings_field_captcha_gateway" => "Gateway Captcha",
"settings_field_captcha_gateway_recaptcha" => "reCaptcha",
"settings_field_captcha_gateway_hcaptcha" => "hCaptcha",
"settings_field_captcha_site_key" => "Chave Site",
"settings_field_captcha_site_key_ph" => "Digite a chave do site",
"settings_field_captcha_secret_key" => "Chave Secreta",
"settings_field_captcha_secret_key_ph" => "Digite a chave secreta",
"settings_field_captcha_register" => "Captcha Tela Registro",
"settings_field_captcha_login" => "Captcha Tela Login",
"settings_field_captcha_recovery" => "Captcha Tela Rec. Senha",
"settings_field_registration" => "Tela de Registro",
"settings_field_terms_conditions" => "Termos e Condições",
"settings_field_terms_conditions_text" => "Termos e Condições",
"settings_field_email_confirmation" => "Confirmação por E-mail",
"settings_field_send_welcome_message" => "E-mail de Boas Vindas",
"settings_field_remember_me" => "Relembrar Me",
"settings_field_forgot_password" => "Recuperar Senha",
"settings_field_send_email_register" => "E-mail",
"settings_field_send_notification_register" => "Notificação Painel",
"settings_field_two_factor_auth" => "Dois Fatores (2FA)",
"settings_field_throttle_auth" => "Autenticação de Tentativas",
"settings_field_throttle_auth_max_attempts" => "Números de Tentativas",
"settings_field_throttle_auth_max_attempts_ph" => "Digite o numero de tentativas",
"settings_field_throttle_auth_lockour_time" => "Tempo de Bloqueio",
"settings_field_throttle_auth_lockour_time_ph" => "Digite o intervalo de tempo",
"settings_field_jwt_token_lifetime" => "JWT Token Tempo",
"settings_field_jwt_token_lifetime_ph" => "Digite tempo de renovação do token",
"settings_field_jwt_private_key" => "JWT Chave Privada",
"settings_field_jwt_private_key_ph" => "Digite a chave privada",
"settings_field_enable_api" => "API RestFul",
"settings_field_remove_log" => "Remover Logs",
"settings_field_remove_log_time" => "Limpar a cada",
"settings_field_remove_log_time_ph" => "Digite o numero de dias para limpar",
"settings_field_remove_log_last_date" => "Última Limpeza",
"settings_field_storage_gateway" => "Gateway Armazenamento",
"settings_field_storage_gateway_local" => "Local",
"settings_field_storage_gateway_aws" => "Amazon S3",
"settings_field_storage_gateway_minio" => "MinIO",
"settings_field_backup_storage" => "Armazenamento",
"settings_field_backup_table" => "Tabela",
"settings_field_backup_table_all" => "Todas",
"settings_field_backup_table_user" => "Usuários",
"settings_field_backup_table_settings" => "Configurações",
"settings_field_backup_email" => "E-mail Notificação",
"settings_field_backup_email_ph" => "Digite o e-mail de notificação",
"settings_field_backup_notification_email" => "Notificar por E-mail",
"settings_field_backup_automatic" => "Backup Automático (Cron)",
"settings_field_backup_time" => "Horário",
"settings_alert_add" => "Salvo com sucesso!",
"settings_alert_error" => "Erro ao Salvar!",
"settings_label_cron" => "Tarefas Cron",
"settings_label_cron_title" => "Configurações de Tarefas Cron",
"settings_label_cron_subtitle_1" => "Abaixo é demonstrado como deve ser configurado as tarefas cron na sua hospedagem.",
"settings_label_cron_subtitle_2" => "Abaixo é listado os últimos registros de erros no crontab.",
"settings_label_cron_timer" => "Temporizador do CronTab:",
"settings_label_cron_timer_time" => "A cada 5 minutos (*/5 * * * *)",
"settings_field_aws_endpoint" => "endpoint (MinIO)",
"settings_field_aws_endpoint_ph" => "Digite o endpoint para MinIO",
"settings_field_aws_key" => "Chave",
"settings_field_aws_key_ph" => "Digite a chave",
"settings_field_aws_secret" => "Chave Secreta",
"settings_field_aws_secret_ph" => "Digite a chave secreta",
"settings_field_aws_region" => "Região",
"settings_field_aws_region_ph" => "Digite a região",
"settings_field_aws_bucket" => "Bucket",
"settings_field_aws_bucket_ph" => "Nome do bucket",
"settings_field_send_user_register" => "Usuário que receberá as notificações",
"settings_label_api_subtitle_2" => "Abaixo é listado todas as chamadas a APIRest.",
"settings_label_api_users" => "Usuários",
"settings_label_api_auth" => "Autenticação e Status Serviço",
"settings_label_api_download" => "Baixar Coleção Postman",
"settings_field_group_api" => "Grupo Acesso Permitido",
"settings_field_block_api" => "Bloquear Acesso Externo",
"settings_field_ip_api" => "Endereço de IP Permitido",
"settings_field_ip_api_ph" => "Defina um endereço de IP, caso marque o bloqueio externo.",
"settings_grid_routine" => "Rotina Cron",
"settings_group_grid_error" => "Mensagem de Erro",
"settings_group_grid_created_at" => "Data Registro",
"settings_alert_email_test_send" => "Enviado com sucesso!",
"settings_alert_email_test_error" => "Erro ao enviar!",
// NOTIFICATION - index
"notification_title" => "Notificações",
"notification_subtitle" => "Lista de Notificações",
"notification_btn_add" => "Adicionar Nova",
"notification_btn_edit" => "Editar",
"notification_btn_delete" => "Deletar",
"notification_grid_sender" => "Remetente",
"notification_grid_recipient" => "Destinatário",
"notification_grid_title" => "Título",
"notification_grid_dashboard" => "Painel",
"notification_grid_created" => "Data Criado",
"notification_grid_updated" => "Data Atualizado",
"notification_grid_email" => "E-mail Enviado?",
"notification_grid_view" => "Lido?",
"notification_grid_options" => "Opções",
"notification_grid_yes" => "Sim",
"notification_grid_no" => "Não",
"notification_delete_title" => "Certeza que deseja deletar?",
"notification_delete_subtitle" => "Você não conseguirá recuperar essa informação!",
"notification_delete_btn_ok" => "Sim, Deletar!",
"notification_delete_btn_cancel" => "Cancelar",
"notification_alert_add" => "Adicionado com sucesso!",
"notification_alert_edit" => "Editado com sucesso!",
"notification_alert_delete" => "Deletado com sucesso!",
// NOTIFICATION - form
"notification_add_title" => "Nova Notificação",
"notification_add_subtitle" => "Adicionar Nova Notificação",
"notification_edit_title" => "Editar Notificação",
"notification_edit_subtitle" => "Editar Notificação",
"notification_field_title" => "Título",
"notification_field_title_ph" => "Digite o título",
"notification_field_user" => "Usuário",
"notification_field_user_all" => "Todos",
"notification_field_body" => "Mensagem",
"notification_field_send_msg" => "Você gostaria de enviar a notificação também por:",
"notification_field_send_email" => "Enviar por e-mail?",
"notification_field_send_label" => "Enviar",
// NOTIFICATION - rules
"notification_rules_title_r" => "O campo título é obrigatório!",
"notification_rules_body_r" => "O campo mensagem é obrigatório!",
// NOTIFICATION - Bell Header
"notification_title_my" => "Minhas Notificações",
"notification_subtitle_my" => "Lista De Notificações",
"notification_subtitle_view" => "Visualizar Minha Notificação",
"notification_bell_btn" => "Veja todas as notificações",
"notification_view_btn" => "Visualizar",
"notification_grid_view_my" => "Visualizado",
"notification_grid_created_my" => "Recebido",
// CronTab and Demo Mode
"crontab_backup_success" => "Backup gerado com sucesso em: ",
"crontab_backup_error" => "Erro ao gerar o backup!",
"crontab_email_error" => "Ocorreu um erro ao tentar enviar e-mail.",
"general_demo_mode" => "Sistema em Modo de Demonstração!",
// v1.2.1
"global_select" => "Selecione um item",
];

View File

@ -0,0 +1,4 @@
<?php
// override core en language system validation or define your own en language validation message
return [];

View File

View File

@ -0,0 +1,160 @@
<?php namespace App\Libraries;
class Authenticator {
protected $codeLength = 6;
public function createSecret($secretLength = 16) {
$validChars = $this->Base32T();
if ($secretLength < 16 || $secretLength > 128) {
throw new Exception('Bad secret length');
}
$secret = '';
$rnd = false;
if (function_exists('random_bytes')) {
$rnd = random_bytes($secretLength);
} elseif (function_exists('mcrypt_create_iv')) {
$rnd = mcrypt_create_iv($secretLength, MCRYPT_DEV_URANDOM);
} elseif (function_exists('openssl_random_pseudo_bytes')) {
$rnd = openssl_random_pseudo_bytes($secretLength, $cryptoStrong);
if (!$cryptoStrong) {
$rnd = false;
}
}
if ($rnd !== false) {
for ($i = 0; $i < $secretLength; ++$i) {
$secret .= $validChars[ord($rnd[$i]) & 31];
}
} else {
throw new Exception('No source of secure random');
}
return $secret;
}
public function getCode($secret, $timeSlice = null) {
if ($timeSlice === null) {
$timeSlice = floor(time() / 30);
}
$secretkey = $this->decode($secret);
$time = chr(0).chr(0).chr(0).chr(0).pack('N*', $timeSlice);
$hm = hash_hmac('SHA1', $time, $secretkey, true);
$offset = ord(substr($hm, -1)) & 0x0F;
$hashpart = substr($hm, $offset, 4);
$value = unpack('N', $hashpart);
$value = $value[1];
$value = $value & 0x7FFFFFFF;
$modulo = pow(10, $this->codeLength);
return str_pad($value % $modulo, $this->codeLength, '0', STR_PAD_LEFT);
}
public function GetQR($name, $secret, $title = null, $params = array()) {
$width = !empty($params['width']) && (int) $params['width'] > 0 ? (int) $params['width'] : 160;
$height = !empty($params['height']) && (int) $params['height'] > 0 ? (int) $params['height'] : 160;
$level = !empty($params['level']) && array_search($params['level'], array('L', 'M', 'Q', 'H')) !== false ? $params['level'] : 'M';
$urlencoded = urlencode('otpauth://totp/'.$name.'?secret='.$secret.'');
if (isset($title)) {
$urlencoded .= urlencode('&issuer='.urlencode($title));
}
return "https://api.qrserver.com/v1/create-qr-code/?data=$urlencoded&size=${width}x${height}&ecc=$level";
}
public function verify($secret, $code, $discrepancy = 1, $currentTimeSlice = null) {
if ($currentTimeSlice === null) {
$currentTimeSlice = floor(time() / 30);
}
if (strlen($code) != 6) {
return false;
}
for ($i = -$discrepancy; $i <= $discrepancy; ++$i) {
$calculatedCode = $this->getCode($secret, $currentTimeSlice + $i);
if ($this->timingSafeEquals($calculatedCode, $code)) {
return true;
}
}
return false;
}
public function setCodeLength($length) {
$this->codeLength = $length;
return $this;
}
protected function decode($secret) {
if (empty($secret)) {
return '';
}
$base32chars = $this->Base32T();
$base32charsFlipped = array_flip($base32chars);
$paddingCharCount = substr_count($secret, $base32chars[32]);
$allowedValues = array(6, 4, 3, 1, 0);
if (!in_array($paddingCharCount, $allowedValues)) {
return false;
}
for ($i = 0; $i < 4; ++$i) {
if ($paddingCharCount == $allowedValues[$i] &&
substr($secret, -($allowedValues[$i])) != str_repeat($base32chars[32], $allowedValues[$i])) {
return false;
}
}
$secret = str_replace('=', '', $secret);
$secret = str_split($secret);
$binaryString = '';
for ($i = 0; $i < count($secret); $i = $i + 8) {
$x = '';
if (!in_array($secret[$i], $base32chars)) {
return false;
}
for ($j = 0; $j < 8; ++$j) {
$x .= str_pad(base_convert(@$base32charsFlipped[@$secret[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT);
}
$eightBits = str_split($x, 8);
for ($z = 0; $z < count($eightBits); ++$z) {
$binaryString .= (($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48) ? $y : '';
}
}
return $binaryString;
}
protected function Base32T() {
return array(
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 7
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 15
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', // 23
'Y', 'Z', '2', '3', '4', '5', '6', '7', // 31
'=', // padding char
);
}
private function timingSafeEquals($safeString, $userString) {
if (function_exists('hash_equals')) {
return hash_equals($safeString, $userString);
}
$safeLen = strlen($safeString);
$userLen = strlen($userString);
if ($userLen != $safeLen) {
return false;
}
$result = 0;
for ($i = 0; $i < $userLen; ++$i) {
$result |= (ord($safeString[$i]) ^ ord($userString[$i]));
}
// They are only identical strings if $result is exactly 0...
return $result === 0;
}
}

View File

@ -0,0 +1,227 @@
<?php namespace App\Libraries;
#
# Portable PHP password hashing framework.
#
# Version 0.5 / genuine.
#
# Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in
# the public domain. Revised in subsequent years, still public domain.
#
# There's absolutely no warranty.
#
# The homepage URL for this framework is:
#
# http://www.openwall.com/phpass/
#
# Please be sure to update the Version line if you edit this file in any way.
# It is suggested that you leave the main version number intact, but indicate
# your project name (after the slash) and add your own revision information.
#
# Please do not change the "private" password hashing method implemented in
# here, thereby making your hashes incompatible. However, if you must, please
# change the hash type identifier (the "$P$") to something different.
#
# Obviously, since this code is in the public domain, the above are not
# requirements (there can be none), but merely suggestions.
#
class PasswordHash {
var $itoa64;
var $iteration_count_log2;
var $portable_hashes;
var $random_state;
function __construct($iteration_count_log2, $portable_hashes)
{
$this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
$iteration_count_log2 = 8;
$this->iteration_count_log2 = $iteration_count_log2;
$this->portable_hashes = $portable_hashes;
$this->random_state = microtime();
if (function_exists('getmypid'))
$this->random_state .= getmypid();
}
function PasswordHash($iteration_count_log2, $portable_hashes)
{
self::__construct($iteration_count_log2, $portable_hashes);
}
function get_random_bytes($count)
{
$output = '';
if (@is_readable('/dev/urandom') &&
($fh = @fopen('/dev/urandom', 'rb'))) {
$output = fread($fh, $count);
fclose($fh);
}
if (strlen($output) < $count) {
$output = '';
for ($i = 0; $i < $count; $i += 16) {
$this->random_state =
md5(microtime() . $this->random_state);
$output .= md5($this->random_state, TRUE);
}
$output = substr($output, 0, $count);
}
return $output;
}
function encode64($input, $count)
{
$output = '';
$i = 0;
do {
$value = ord($input[$i++]);
$output .= $this->itoa64[$value & 0x3f];
if ($i < $count)
$value |= ord($input[$i]) << 8;
$output .= $this->itoa64[($value >> 6) & 0x3f];
if ($i++ >= $count)
break;
if ($i < $count)
$value |= ord($input[$i]) << 16;
$output .= $this->itoa64[($value >> 12) & 0x3f];
if ($i++ >= $count)
break;
$output .= $this->itoa64[($value >> 18) & 0x3f];
} while ($i < $count);
return $output;
}
function gensalt_private($input)
{
$output = '$P$';
$output .= $this->itoa64[min($this->iteration_count_log2 +
((PHP_VERSION >= '5') ? 5 : 3), 30)];
$output .= $this->encode64($input, 6);
return $output;
}
function crypt_private($password, $setting)
{
$output = '*0';
if (substr($setting, 0, 2) === $output)
$output = '*1';
$id = substr($setting, 0, 3);
# We use "$P$", phpBB3 uses "$H$" for the same thing
if ($id !== '$P$' && $id !== '$H$')
return $output;
$count_log2 = strpos($this->itoa64, $setting[3]);
if ($count_log2 < 7 || $count_log2 > 30)
return $output;
$count = 1 << $count_log2;
$salt = substr($setting, 4, 8);
if (strlen($salt) !== 8)
return $output;
# We were kind of forced to use MD5 here since it's the only
# cryptographic primitive that was available in all versions
# of PHP in use. To implement our own low-level crypto in PHP
# would have resulted in much worse performance and
# consequently in lower iteration counts and hashes that are
# quicker to crack (by non-PHP code).
$hash = md5($salt . $password, TRUE);
do {
$hash = md5($hash . $password, TRUE);
} while (--$count);
$output = substr($setting, 0, 12);
$output .= $this->encode64($hash, 16);
return $output;
}
function gensalt_blowfish($input)
{
# This one needs to use a different order of characters and a
# different encoding scheme from the one in encode64() above.
# We care because the last character in our encoded string will
# only represent 2 bits. While two known implementations of
# bcrypt will happily accept and correct a salt string which
# has the 4 unused bits set to non-zero, we do not want to take
# chances and we also do not want to waste an additional byte
# of entropy.
$itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$output = '$2a$';
$output .= chr(ord('0') + $this->iteration_count_log2 / 10);
$output .= chr(ord('0') + $this->iteration_count_log2 % 10);
$output .= '$';
$i = 0;
do {
$c1 = ord($input[$i++]);
$output .= $itoa64[$c1 >> 2];
$c1 = ($c1 & 0x03) << 4;
if ($i >= 16) {
$output .= $itoa64[$c1];
break;
}
$c2 = ord($input[$i++]);
$c1 |= $c2 >> 4;
$output .= $itoa64[$c1];
$c1 = ($c2 & 0x0f) << 2;
$c2 = ord($input[$i++]);
$c1 |= $c2 >> 6;
$output .= $itoa64[$c1];
$output .= $itoa64[$c2 & 0x3f];
} while (1);
return $output;
}
function HashPassword($password)
{
$random = '';
if (CRYPT_BLOWFISH === 1 && !$this->portable_hashes) {
$random = $this->get_random_bytes(16);
$hash =
crypt($password, $this->gensalt_blowfish($random));
if (strlen($hash) === 60)
return $hash;
}
if (strlen($random) < 6)
$random = $this->get_random_bytes(6);
$hash =
$this->crypt_private($password,
$this->gensalt_private($random));
if (strlen($hash) === 34)
return $hash;
# Returning '*' on error is safe here, but would _not_ be safe
# in a crypt(3)-like function used _both_ for generating new
# hashes and for validating passwords against existing hashes.
return '*';
}
function CheckPassword($password, $stored_hash)
{
$hash = $this->crypt_private($password, $stored_hash);
if ($hash[0] === '*')
$hash = crypt($password, $stored_hash);
# This is not constant-time. In order to keep the code simple,
# for timing safety we currently rely on the salts being
# unpredictable, which they are at least in the non-fallback
# cases (that is, when we use /dev/urandom and bcrypt).
return $hash === $stored_hash;
}
}
?>

0
ci4/app/Models/.gitkeep Normal file
View File

View File

@ -0,0 +1,20 @@
<?php
namespace App\Models;
class ActivityModel extends BaseModel
{
protected $table = 'auth_activity';
protected $primaryKey = 'id_activity';
protected $allowedFields = [
'user',
'level',
'event',
'ip',
'os',
'browser',
'detail'
];
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\Models;
class BackupModel extends BaseModel
{
protected $table = 'auth_backup';
protected $primaryKey = 'id_backup';
protected $allowedFields = [
'path',
'error'
];
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class BaseModel extends Model
{
protected $afterFind = [
'escapeXSS'
];
protected function escapeXSS($data)
{
return esc($data);
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Models;
class ConfirmationTokenModel extends BaseModel
{
protected $table = 'auth_confirmation_token';
protected $primaryKey = 'id_confirmation';
protected $allowedFields = [
'user',
'token',
'confirmed',
'type'
];
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Models;
class CountriesModel extends BaseModel
{
protected $table = 'auth_countries';
protected $primaryKey = 'id_country';
protected $allowedFields = [
'phone',
'code',
'name',
'symbol',
'capital',
'currency',
'continent',
'continent_code',
'alpha_3',
'data_lang'
];
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\Models;
class CronTabModel extends BaseModel
{
protected $table = 'auth_crontab_history';
protected $primaryKey = 'id_crontab';
protected $allowedFields = [
'routine',
'error'
];
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Models;
class CurrencyModel extends BaseModel
{
protected $table = 'auth_currency';
protected $primaryKey = 'id_currency';
protected $allowedFields = [
'code',
'name',
'data_lang'
];
}

View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
class GroupUserModel extends BaseModel
{
protected $table = 'group_user';
protected $allowedFields = [
'token_user',
'token_group'
];
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Models;
class NotificationModel extends BaseModel
{
protected $table = 'auth_notification';
protected $primaryKey = 'id_notification';
protected $allowedFields = [
'user_sender',
'user_recipient',
'title',
'body',
'is_read',
'is_send_email',
'send_email_notification',
'token'
];
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Models;
class PasswordRecoveryModel extends BaseModel
{
protected $table = 'auth_password_recovery';
protected $primaryKey = 'id_pass_recovery';
protected $allowedFields = [
'user',
'token',
'changed'
];
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
}

View File

@ -0,0 +1,82 @@
<?php
namespace App\Models;
class SettingsModel extends BaseModel
{
protected $table = 'auth_settings';
protected $primaryKey = 'id_settings';
protected $allowedFields = [
'title',
'activate_frontend',
'logo',
'icon',
'default_language',
'default_role',
'default_date_format',
'default_hour_format',
'default_currency',
'default_currency_position',
'default_currency_separation',
'default_country',
'default_theme',
'default_theme_front',
'default_timezone',
'seo_description',
'seo_keywords',
'email_gateway',
'email_name',
'email_address',
'email_smtp',
'email_port',
'email_pass',
'email_cert',
'email_account_id',
'email_auth_token',
'email_info_add',
'captcha_gateway',
'captcha_site_key',
'captcha_secret_key',
'captcha_register',
'captcha_login',
'captcha_recovery',
'registration',
'terms_conditions',
'terms_conditions_text',
'email_confirmation',
'send_user_register',
'send_email_register',
'send_notification_register',
'send_email_welcome',
'remember_me',
'forgot_password',
'two_factor_auth',
'throttle_auth',
'throttle_auth_max_attempts',
'throttle_auth_lockour_time',
'jwt_token_lifetime',
'jwt_private_key',
'group_api',
'block_external_api',
'ip_allowed_api',
'enable_api',
'remove_log',
'remove_log_time',
'remove_log_latest',
'storage_gateway',
'aws_endpoint',
'aws_key',
'aws_secret',
'aws_region',
'aws_bucket',
'backup_storage',
'backup_table',
'backup_email',
'backup_notification_email',
'backup_automatic',
'backup_time',
'backup_latest',
'purchase_code'
];
protected $useTimestamps = true;
protected $updatedField = 'updated_at';
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Models;
class TemplateModel extends BaseModel
{
protected $table = 'auth_template';
protected $primaryKey = 'id_template';
protected $allowedFields = [
'name',
'subject',
'body',
'type'
];
protected $useTimestamps = true;
protected $updatedField = 'updated_at';
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Models;
class ThemeModel extends BaseModel
{
protected $table = 'auth_theme';
protected $primaryKey = 'id_theme';
protected $allowedFields = [
'name',
'type',
'path'
];
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Models;
class TimezoneModel extends BaseModel
{
protected $table = 'auth_timezone';
protected $primaryKey = 'id_timezone';
protected $allowedFields = [
'timezone',
'description'
];
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Models;
class UserGroupModel extends BaseModel
{
protected $table = 'auth_user_group';
protected $primaryKey = 'id_group';
protected $allowedFields = [
'title',
'dashboard',
'rules',
'token'
];
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
}

View File

@ -0,0 +1,36 @@
<?php
namespace App\Models;
class UserModel extends BaseModel
{
protected $table = 'auth_user';
protected $primaryKey = 'id_user';
protected $allowedFields = [
'group',
'first_name',
'last_name',
'date_birth',
'address',
'city',
'state',
'country',
'zip_code',
'mobile',
'email',
'password',
'last_ip',
'last_access',
'picture',
'language',
'tfa',
'tfa_secret',
'tfa_code',
'blocked',
'email_confirmed',
'token',
'status'
];
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
}

0
ci4/app/ThirdParty/.gitkeep vendored Normal file
View File

View File

@ -0,0 +1,36 @@
<?php
namespace App\Validation;
use App\Libraries\PasswordHash;
use App\Models\SettingsModel;
use App\Models\UserModel;
use Exception;
class ApiAuthRules
{
public function validateAuthPassword(string $str, string $fields, array $data): bool
{
try {
$user_model = new UserModel();
$obj = $user_model->where('email',$data['email'])->first();
$phpass = new PasswordHash(8, true);
return $phpass->CheckPassword($data['password']??'', $obj['password']);
} catch (Exception $e) {
return false;
}
}
public function validateAuthPermission(string $str, string $fields, array $data): bool
{
try {
$user_model = new UserModel();
$settings_model = new SettingsModel();
$settings = $settings_model->first()??[];
$obj = $user_model->where('email',$data['email'])->first();
return $settings['group_api'] == $obj['group'];
} catch (Exception $e) {
return false;
}
}
}

View File

@ -0,0 +1,7 @@
<?php
use CodeIgniter\CLI\CLI;
CLI::error('ERROR: ' . $code);
CLI::write($message);
CLI::newLine();

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