Removed application folder (Ci3) added maintenance mode

This commit is contained in:
2026-01-12 17:07:11 +01:00
parent f0b9c6ad40
commit 5b73926ffe
227 changed files with 327 additions and 17706 deletions
+60
View File
@@ -0,0 +1,60 @@
<?php
namespace App\Commands;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
class Down extends BaseCommand
{
protected $group = 'Housekeeping';
protected $name = 'down';
protected $description = 'Put the application into maintenance mode.';
protected $usage = 'down [options]';
protected $options = [
'--allow' => 'IP address(es) to whitelist (comma-separated or use multiple --allow)',
'--message' => 'Custom message for the maintenance page',
];
public function run(array $params)
{
$allowedIps = [];
// Get allowed IPs from command line
if (CLI::getOption('allow')) {
$allow = CLI::getOption('allow');
if (is_array($allow)) {
foreach ($allow as $ip) {
$allowedIps = array_merge($allowedIps, array_map('trim', explode(',', $ip)));
}
} else {
$allowedIps = array_map('trim', explode(',', $allow));
}
}
// Get custom message
$message = CLI::getOption('message') ?: '';
// Create maintenance data
$data = [
'time' => date('Y-m-d H:i:s'),
'allowed' => array_values(array_filter($allowedIps)),
'message' => $message,
];
$filePath = WRITEPATH . 'down';
if (file_put_contents($filePath, json_encode($data, JSON_PRETTY_PRINT))) {
CLI::write('Application is now in maintenance mode.', 'yellow');
if (! empty($allowedIps)) {
CLI::write('Whitelisted IPs: ' . implode(', ', $allowedIps), 'green');
}
} else {
CLI::error('Failed to enable maintenance mode. Check writable directory permissions.');
return 1;
}
return 0;
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Commands;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
class Up extends BaseCommand
{
protected $group = 'Housekeeping';
protected $name = 'up';
protected $description = 'Bring the application out of maintenance mode.';
protected $usage = 'up';
public function run(array $params)
{
$filePath = WRITEPATH . 'down';
if (! file_exists($filePath)) {
CLI::write('Application is not in maintenance mode.', 'yellow');
return 0;
}
if (unlink($filePath)) {
CLI::write('Application is now live.', 'green');
} else {
CLI::error('Failed to disable maintenance mode. Check file permissions.');
return 1;
}
return 0;
}
}
+113
View File
@@ -0,0 +1,113 @@
<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Website in onderhoud</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
color: #ffffff;
}
.container {
text-align: center;
padding: 2rem;
max-width: 600px;
}
.icon {
font-size: 4rem;
margin-bottom: 1.5rem;
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { transform: scale(1); opacity: 1; }
50% { transform: scale(1.1); opacity: 0.8; }
}
h1 {
font-size: 2.5rem;
font-weight: 600;
margin-bottom: 1rem;
color: #e94560;
}
.message {
font-size: 1.2rem;
line-height: 1.8;
color: #b8b8b8;
margin-bottom: 2rem;
}
.status {
display: inline-flex;
align-items: center;
gap: 0.5rem;
background: rgba(255, 255, 255, 0.1);
padding: 0.75rem 1.5rem;
border-radius: 50px;
font-size: 0.9rem;
color: #4ecca3;
}
.status-dot {
width: 10px;
height: 10px;
background: #4ecca3;
border-radius: 50%;
animation: blink 1.5s ease-in-out infinite;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0.3; }
}
.contact {
margin-top: 2.5rem;
font-size: 0.9rem;
color: #888;
}
.contact a {
color: #e94560;
text-decoration: none;
}
.contact a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="container">
<div class="icon">🔧</div>
<h1>Even geduld...</h1>
<p class="message">
We zijn bezig met onderhoudswerkzaamheden om DBOIS te verbeteren.
We zijn zo snel mogelijk weer online.
</p>
<div class="status">
<span class="status-dot"></span>
Onderhoud in uitvoering!
</div>
<p class="contact">
Vragen? Neem contact op via <a href="mailto:info@pensare.nl">info@pensare.nl</a>
</p>
</div>
</body>
</html>
-6
View File
@@ -1,6 +0,0 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
-11
View File
@@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
-135
View File
@@ -1,135 +0,0 @@
<?php
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
| is made regarding whether you intend to use it. This file lets
| you globally define which systems you would like loaded with every
| request.
|
| -------------------------------------------------------------------
| Instructions
| -------------------------------------------------------------------
|
| These are the things you can load automatically:
|
| 1. Packages
| 2. Libraries
| 3. Drivers
| 4. Helper files
| 5. Custom config files
| 6. Language files
| 7. Models
|
*/
/*
| -------------------------------------------------------------------
| Auto-load Packages
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
$autoload['packages'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in system/libraries/ or your
| application/libraries/ directory, with the addition of the
| 'database' library, which is somewhat of a special case.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'email', 'session');
|
| You can also supply an alternative library name to be assigned
| in the controller:
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('database', 'session');
/*
| -------------------------------------------------------------------
| Auto-load Drivers
| -------------------------------------------------------------------
| These classes are located in system/libraries/ or in your
| application/libraries/ directory, but are also placed inside their
| own subdirectory and they extend the CI_Driver_Library class. They
| offer multiple interchangeable driver options.
|
| Prototype:
|
| $autoload['drivers'] = array('cache');
|
| You can also supply an alternative property name to be assigned in
| the controller:
|
| $autoload['drivers'] = array('cache' => 'cch');
|
*/
$autoload['drivers'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('common');
/*
| -------------------------------------------------------------------
| Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files. Otherwise, leave it blank.
|
*/
$autoload['config'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['language'] = array('lang1', 'lang2');
|
| NOTE: Do not include the "_lang" part of your file. For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/
$autoload['language'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Models
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['model'] = array('first_model', 'second_model');
|
| You can also supply an alternative model name to be assigned
| in the controller:
|
| $autoload['model'] = array('first_model' => 'first');
*/
$autoload['model'] = ['beheer/User_model', ];
-523
View File
@@ -1,523 +0,0 @@
<?php
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try guess the protocol and path
| your installation, but due to security concerns the hostname will be set
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
|
| If you need to allow multiple domains, remember that this file is still
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = '';
/*
|--------------------------------------------------------------------------
| 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.
|
*/
$config['index_page'] = 'index.php';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'REQUEST_URI' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| 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.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = TRUE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/core_classes.html
| https://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';
/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = FALSE;
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
/*
|--------------------------------------------------------------------------
| Allow $_GET array
|--------------------------------------------------------------------------
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['allow_get_array'] = TRUE;
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| You can also pass an array with threshold levels to show individual error types
|
| array(2) = Debug Messages, without Error Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 1;
/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ directory. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
/*
|--------------------------------------------------------------------------
| Log File Extension
|--------------------------------------------------------------------------
|
| The default filename extension for log files. The default '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 'php'.
|
*/
$config['log_file_extension'] = '';
/*
|--------------------------------------------------------------------------
| Log File Permissions
|--------------------------------------------------------------------------
|
| 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.)
*/
$config['log_file_permissions'] = 0644;
/*
|--------------------------------------------------------------------------
| 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
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
/*
|--------------------------------------------------------------------------
| Error Views Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/views/errors/ directory. Use a full server path with trailing slash.
|
*/
$config['error_views_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/cache/ directory. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';
/*
|--------------------------------------------------------------------------
| 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.
|
*/
$config['cache_query_string'] = FALSE;
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class, you must set an encryption key.
| See the user guide for more info.
|
| https://codeigniter.com/user_guide/libraries/encryption.html
|
*/
$config['encryption_key'] = '';
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_driver'
|
| The storage driver to use: files, database, redis, memcached
|
| 'sess_cookie_name'
|
| The session cookie name, must contain only [0-9a-z_-] characters
|
| 'sess_expiration'
|
| The number of SECONDS you want the session to last.
| Setting to 0 (zero) means expire when the browser is closed.
|
| 'sess_save_path'
|
| The location to save sessions to, 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!
|
| 'sess_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.
|
| 'sess_time_to_update'
|
| How many seconds between CI regenerating the session ID.
|
| 'sess_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.
|
| Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path' = Typically will be a forward slash
| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
|
| Note: These settings (with the exception of 'cookie_prefix' and
| 'cookie_httponly') will also affect sessions.
|
*/
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
/*
|--------------------------------------------------------------------------
| Standardize newlines
|--------------------------------------------------------------------------
|
| Determines whether to standardize newline characters in input data,
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['standardize_newlines'] = FALSE;
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['global_xss_filtering'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
| checked on a submitted form. If you are accepting user data, it is strongly
| recommended CSRF protection be enabled.
|
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
| 'csrf_regenerate' = Regenerate token on every submission
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
*/
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = [];
/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads. When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| Only used if zlib.output_compression is turned off in your php.ini.
| Please do not use it together with httpd-level output compression.
|
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts. For
| compression to work, nothing can be sent before the output buffer is called
| by the output class. Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are 'local' or any PHP supported timezone. This preference tells
| the system whether to use your server's local time as the master 'now'
| reference, or convert it to the configured one timezone. See the 'date
| helper' page of the user guide for information regarding date handling.
|
*/
$config['time_reference'] = 'local';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
| Note: You need to have eval() enabled for this to work.
|
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| 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: array('10.0.1.200', '192.168.5.0/24')
*/
$config['proxy_ips'] = '';
-85
View File
@@ -1,85 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Display Debug backtrace
|--------------------------------------------------------------------------
|
| If set to TRUE, a backtrace will be displayed along with php errors. If
| error_reporting is disabled, the backtrace will not display, regardless
| of this setting
|
*/
defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
/*
|--------------------------------------------------------------------------
| File and Directory Modes
|--------------------------------------------------------------------------
|
| These prefs are used when checking and setting modes when working
| with the file system. The defaults are fine on servers with proper
| security, but you may wish (or even need) to change the values in
| certain environments (Apache running a separate process for each
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
| always be used to set the mode correctly.
|
*/
defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644);
defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);
defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755);
defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
/*
|--------------------------------------------------------------------------
| File Stream Modes
|--------------------------------------------------------------------------
|
| These modes are used when working with fopen()/popen()
|
*/
defined('FOPEN_READ') OR define('FOPEN_READ', 'rb');
defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b');
defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab');
defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');
defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
/*
|--------------------------------------------------------------------------
| 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') OR define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
-96
View File
@@ -1,96 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
| ['dsn'] The full DSN string describe a connection to the database.
| ['hostname'] The hostname of your database server.
| ['username'] The username used to connect to the database
| ['password'] The password used to connect to the database
| ['database'] The name of the database you want to connect to
| ['dbdriver'] The database driver. e.g.: mysqli.
| Currently supported:
| cubrid, ibase, mssql, mysql, mysqli, oci8,
| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
| ['dbprefix'] You can add an optional prefix, which will be added
| to the table name when using the Query Builder class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
| ['cachedir'] The path to the folder where cache files should be stored
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| NOTE: For MySQL and MySQLi databases, this setting is only used
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
| (and in table creation queries made with DB Forge).
| There is an incompatibility in PHP with mysql_real_escape_string() which
| can make your site vulnerable to SQL injection if you are using a
| multi-byte character set and are running versions lower than these.
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['encrypt'] Whether or not to use an encrypted connection.
|
| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
|
| 'ssl_key' - Path to the private key file
| 'ssl_cert' - Path to the public key certificate file
| 'ssl_ca' - Path to the certificate authority file
| 'ssl_capath' - Path to a directory containing trusted CA certificats in PEM format
| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not ('mysqli' only)
|
| ['compress'] Whether or not to use client compression (MySQL only)
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
| ['failover'] array - A array with 0 or more data for connections if the main should fail.
| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
| NOTE: Disabling this will also effectively disable both
| $this->db->last_query() and profiling of DB queries.
| When you run a query, with this setting set to TRUE (default),
| CodeIgniter will store the SQL statement for debugging purposes.
| However, this may cause high memory usage, especially if you run
| a lot of SQL queries ... disable this to avoid that problem.
|
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
|
| The $query_builder variables lets you determine whether or not to load
| the query builder class.
*/
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => $_ENV['DB_HOST'],
'username' => $_ENV['DB_USER'],
'password' => $_ENV['DB_PASS'],
'database' => $_ENV['DB_NAME'],
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
-24
View File
@@ -1,24 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$_doctypes = array(
'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">'
);
-27
View File
@@ -1,27 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 27/12/2017
* Time: 15:17
*/
// Use $_ENV instead of getenv() for better compatibility
$config['charset'] = 'iso-8859-1';
$config['protocol'] = $_ENV['PROTOCOL'] ?? 'mail';
$config['smtp_host'] = $_ENV['SMTP_HOST'] ?? '';
$config['smtp_user'] = $_ENV['SMTP_USER'] ?? '';
$config['smtp_pass'] = $_ENV['SMTP_PASS'] ?? '';
$config['smtp_port'] = $_ENV['SMTP_PORT'] ?? 25;
$config['smtp_crypto'] = 'tls';
$config['smtp_timeout'] = 30;
$config['mailtype'] = 'html';
$config['newline'] = "\r\n";
$config['crlf'] = "\r\n";
$config['wordwrap'] = TRUE;
$config['validate'] = TRUE;
-103
View File
@@ -1,103 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| Foreign Characters
| -------------------------------------------------------------------
| This file contains an array of foreign characters for transliteration
| conversion used by the Text helper
|
*/
$foreign_characters = array(
'/ä|æ|ǽ/' => 'ae',
'/ö|œ/' => 'oe',
'/ü/' => 'ue',
'/Ä/' => 'Ae',
'/Ü/' => 'Ue',
'/Ö/' => 'Oe',
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A',
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a',
'/Б/' => 'B',
'/б/' => 'b',
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
'/ç|ć|ĉ|ċ|č/' => 'c',
'/Д/' => 'D',
'/д/' => 'd',
'/Ð|Ď|Đ|Δ/' => 'Dj',
'/ð|ď|đ|δ/' => 'dj',
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E',
'/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e',
'/Ф/' => 'F',
'/ф/' => 'f',
'/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G',
'/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g',
'/Ĥ|Ħ/' => 'H',
'/ĥ|ħ/' => 'h',
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I',
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i',
'/Ĵ/' => 'J',
'/ĵ/' => 'j',
'/Ķ|Κ|К/' => 'K',
'/ķ|κ|к/' => 'k',
'/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L',
'/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l',
'/М/' => 'M',
'/м/' => 'm',
'/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N',
'/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n',
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O',
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o',
'/П/' => 'P',
'/п/' => 'p',
'/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R',
'/ŕ|ŗ|ř|ρ|р/' => 'r',
'/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S',
'/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's',
'/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T',
'/ț|ţ|ť|ŧ|т/' => 't',
'/Þ|þ/' => 'th',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U',
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u',
'/Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y',
'/ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y',
'/В/' => 'V',
'/в/' => 'v',
'/Ŵ/' => 'W',
'/ŵ/' => 'w',
'/Ź|Ż|Ž|Ζ|З/' => 'Z',
'/ź|ż|ž|ζ|з/' => 'z',
'/Æ|Ǽ/' => 'AE',
'/ß/' => 'ss',
'/IJ/' => 'IJ',
'/ij/' => 'ij',
'/Œ/' => 'OE',
'/ƒ/' => 'f',
'/ξ/' => 'ks',
'/π/' => 'p',
'/β/' => 'v',
'/μ/' => 'm',
'/ψ/' => 'ps',
'/Ё/' => 'Yo',
'/ё/' => 'yo',
'/Є/' => 'Ye',
'/є/' => 'ye',
'/Ї/' => 'Yi',
'/Ж/' => 'Zh',
'/ж/' => 'zh',
'/Х/' => 'Kh',
'/х/' => 'kh',
'/Ц/' => 'Ts',
'/ц/' => 'ts',
'/Ч/' => 'Ch',
'/ч/' => 'ch',
'/Ш/' => 'Sh',
'/ш/' => 'sh',
'/Щ/' => 'Shch',
'/щ/' => 'shch',
'/Ъ|ъ|Ь|ь/' => '',
'/Ю/' => 'Yu',
'/ю/' => 'yu',
'/Я/' => 'Ya',
'/я/' => 'ya'
);
-23
View File
@@ -1,23 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
| files. Please see the user guide for info:
|
| https://codeigniter.com/user_guide/general/hooks.html
|
*/
$hook['post_controller_constructor'][] = [
'class' => 'EloquentHook',
'function' => 'bootEloquent',
'filename' => 'EloquentHook.php',
'filepath' => 'hooks'
];
-11
View File
@@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
-19
View File
@@ -1,19 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Memcached settings
| -------------------------------------------------------------------------
| Your Memcached servers can be specified below.
|
| See: https://codeigniter.com/user_guide/libraries/caching.html#memcached
|
*/
$config = array(
'default' => array(
'hostname' => '127.0.0.1',
'port' => '11211',
'weight' => '1',
),
);
-84
View File
@@ -1,84 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Enable/Disable Migrations
|--------------------------------------------------------------------------
|
| Migrations are disabled by default for security reasons.
| You should enable migrations whenever you intend to do a schema migration
| and disable it back when you're done.
|
*/
$config['migration_enabled'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migration Type
|--------------------------------------------------------------------------
|
| Migration file names may be based on a sequential identifier or on
| a timestamp. Options are:
|
| 'sequential' = Sequential migration naming (001_add_blog.php)
| 'timestamp' = Timestamp migration naming (20121031104401_add_blog.php)
| Use timestamp format YYYYMMDDHHIISS.
|
| Note: If this configuration value is missing the Migration library
| defaults to 'sequential' for backward compatibility with CI2.
|
*/
$config['migration_type'] = 'timestamp';
/*
|--------------------------------------------------------------------------
| 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.
|
*/
$config['migration_table'] = 'migrations';
/*
|--------------------------------------------------------------------------
| Auto Migrate To Latest
|--------------------------------------------------------------------------
|
| If this is set to TRUE when you load the migrations class and have
| $config['migration_enabled'] set to TRUE the system will auto migrate
| to your latest migration (whatever $config['migration_version'] is
| set to). This way you do not have to call migrations anywhere else
| in your code to have the latest migration.
|
*/
$config['migration_auto_latest'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migrations version
|--------------------------------------------------------------------------
|
| This is used to set migration version that the file system should be on.
| If you run $this->migration->current() this is the version that schema will
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 0;
/*
|--------------------------------------------------------------------------
| Migrations Path
|--------------------------------------------------------------------------
|
| Path to your migrations folder.
| Typically, it will be within your application path.
| Also, writing permission is required within the migrations path.
|
*/
$config['migration_path'] = APPPATH.'migrations/';
-183
View File
@@ -1,183 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| MIME TYPES
| -------------------------------------------------------------------
| This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types.
|
*/
return array(
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
'cpt' => 'application/mac-compactpro',
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
'bin' => array('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' => array('application/octet-stream', 'application/x-msdownload'),
'class' => 'application/octet-stream',
'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
'ai' => array('application/pdf', 'application/postscript'),
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => array('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' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
'pptx' => array('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' => array('application/x-httpd-php', 'application/php', 'application/x-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' => array('application/x-javascript', 'text/plain'),
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
'z' => 'application/x-compress',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
'aif' => array('audio/x-aiff', 'audio/aiff'),
'aiff' => array('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' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
'bmp' => array('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',
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
'jpe' => array('image/jpeg', 'image/pjpeg'),
'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'png' => array('image/png', 'image/x-png'),
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'css' => array('text/css', 'text/plain'),
'html' => array('text/html', 'text/plain'),
'htm' => array('text/html', 'text/plain'),
'shtml' => array('text/html', 'text/plain'),
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => array('text/plain', 'text/x-log'),
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => array('application/xml', 'text/xml', 'text/plain'),
'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
'movie' => 'video/x-sgi-movie',
'doc' => array('application/msword', 'application/vnd.ms-office'),
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
'dot' => array('application/msword', 'application/vnd.ms-office'),
'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'),
'word' => array('application/msword', 'application/octet-stream'),
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => array('application/json', 'text/json'),
'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
'p10' => array('application/x-pkcs10', 'application/pkcs10'),
'p12' => 'application/x-pkcs12',
'p7a' => 'application/x-pkcs7-signature',
'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
'p7r' => 'application/x-pkcs7-certreqresp',
'p7s' => 'application/pkcs7-signature',
'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
'crl' => array('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' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
'3g2' => 'video/3gpp2',
'3gp' => array('video/3gp', 'video/3gpp'),
'mp4' => 'video/mp4',
'm4a' => 'audio/x-m4a',
'f4v' => array('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' => array('video/x-ms-wmv', 'video/x-ms-asf'),
'au' => 'audio/x-au',
'ac3' => 'audio/ac3',
'flac' => 'audio/x-flac',
'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'),
'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
'ics' => 'text/calendar',
'ical' => 'text/calendar',
'zsh' => 'text/x-scriptzsh',
'7zip' => array('application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
'vcf' => 'text/x-vcard',
'srt' => array('text/srt', 'text/plain'),
'vtt' => array('text/vtt', 'text/plain'),
'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'),
'odc' => 'application/vnd.oasis.opendocument.chart',
'otc' => 'application/vnd.oasis.opendocument.chart-template',
'odf' => 'application/vnd.oasis.opendocument.formula',
'otf' => 'application/vnd.oasis.opendocument.formula-template',
'odg' => 'application/vnd.oasis.opendocument.graphics',
'otg' => 'application/vnd.oasis.opendocument.graphics-template',
'odi' => 'application/vnd.oasis.opendocument.image',
'oti' => 'application/vnd.oasis.opendocument.image-template',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
'odt' => 'application/vnd.oasis.opendocument.text',
'odm' => 'application/vnd.oasis.opendocument.text-master',
'ott' => 'application/vnd.oasis.opendocument.text-template',
'oth' => 'application/vnd.oasis.opendocument.text-web'
);
-14
View File
@@ -1,14 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Profiler Sections
| -------------------------------------------------------------------------
| This file lets you determine whether or not various sections of Profiler
| data are displayed when the Profiler is enabled.
| Please see the user guide for info:
|
| https://codeigniter.com/user_guide/general/profiling.html
|
*/
-54
View File
@@ -1,54 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
| https://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There are three reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router which controller/method to use if those
| provided in the URL cannot be matched to a valid route.
|
| $route['translate_uri_dashes'] = FALSE;
|
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method
*/
$route['default_controller'] = 'main';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
-64
View File
@@ -1,64 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| SMILEYS
| -------------------------------------------------------------------
| This file contains an array of smileys for use with the emoticon helper.
| Individual images can be used to replace multiple smileys. For example:
| :-) and :) use the same image replacement.
|
| Please see user guide for more info:
| https://codeigniter.com/user_guide/helpers/smiley_helper.html
|
*/
$smileys = array(
// smiley image name width height alt
':-)' => array('grin.gif', '19', '19', 'grin'),
':lol:' => array('lol.gif', '19', '19', 'LOL'),
':cheese:' => array('cheese.gif', '19', '19', 'cheese'),
':)' => array('smile.gif', '19', '19', 'smile'),
';-)' => array('wink.gif', '19', '19', 'wink'),
';)' => array('wink.gif', '19', '19', 'wink'),
':smirk:' => array('smirk.gif', '19', '19', 'smirk'),
':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'),
':-S' => array('confused.gif', '19', '19', 'confused'),
':wow:' => array('surprise.gif', '19', '19', 'surprised'),
':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'),
':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
'%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'),
':P' => array('raspberry.gif', '19', '19', 'raspberry'),
':blank:' => array('blank.gif', '19', '19', 'blank stare'),
':long:' => array('longface.gif', '19', '19', 'long face'),
':ohh:' => array('ohh.gif', '19', '19', 'ohh'),
':grrr:' => array('grrr.gif', '19', '19', 'grrr'),
':gulp:' => array('gulp.gif', '19', '19', 'gulp'),
'8-/' => array('ohoh.gif', '19', '19', 'oh oh'),
':down:' => array('downer.gif', '19', '19', 'downer'),
':red:' => array('embarrassed.gif', '19', '19', 'red face'),
':sick:' => array('sick.gif', '19', '19', 'sick'),
':shut:' => array('shuteye.gif', '19', '19', 'shut eye'),
':-/' => array('hmm.gif', '19', '19', 'hmmm'),
'>:(' => array('mad.gif', '19', '19', 'mad'),
':mad:' => array('mad.gif', '19', '19', 'mad'),
'>:-(' => array('angry.gif', '19', '19', 'angry'),
':angry:' => array('angry.gif', '19', '19', 'angry'),
':zip:' => array('zip.gif', '19', '19', 'zipper'),
':kiss:' => array('kiss.gif', '19', '19', 'kiss'),
':ahhh:' => array('shock.gif', '19', '19', 'shock'),
':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'),
':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'),
':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'),
':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'),
':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'),
':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
':snake:' => array('snake.gif', '19', '19', 'snake'),
':exclaim:' => array('exclaim.gif', '19', '19', 'exclaim'),
':question:' => array('question.gif', '19', '19', 'question')
);
-214
View File
@@ -1,214 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| USER AGENT TYPES
| -------------------------------------------------------------------
| 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.
*/
$platforms = array(
'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'
);
// The order of this array should NOT be changed. Many browsers return
// multiple browser types so we want to identify the sub-type first.
$browsers = array(
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => 'Spartan',
'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'
);
$mobiles = array(
// 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'
);
// There are hundreds of bots but these are the most common.
$robots = array(
'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'
);
-309
View File
@@ -1,309 +0,0 @@
<?php
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 05/12/2017
* Time: 11:01
*/
class Login extends MY_Controller {
public function __construct()
{
parent::__construct();
$this->load->library( 'beheer/session/CreateUserSession' );
$this->load->library( 'TwoFactorAuth' );
$this->load->model( 'beheer/UserOtp_model' );
}
public function index()
{
$username = $this->clean_input( 'username' );
$password = $this->clean_input( 'password' );
$user = $this->User_model->getUserByUsername( $username );
if ( ! $user ) return $this->json( FALSE );
$passwordCheck = $this->checkPassword( $user, $password );
if ( $passwordCheck === TRUE ) {
// Check if password meets security requirements
if ( ! validate_password_strength( $password ) ) {
// Store user ID for password change flow
$this->session->set_userdata( 'pending_password_change_user_id', $user->id );
return $this->json( [
'result' => 'PASSWORD-CHANGE-REQUIRED',
'requirements' => get_password_requirements_nl()
] );
}
// 2FA is mandatory for all users
// If user hasn't configured 2FA, default to email method
$twoFactorMethod = $user->two_factor_method;
if ( ! $twoFactorMethod || $user->two_factor_enabled !== 'T' ) {
// Default to email method for users without 2FA configured
$twoFactorMethod = 'email';
}
// Store user ID in temporary session for 2FA verification
$this->session->set_userdata( 'pending_2fa_user_id', $user->id );
$this->session->set_userdata( 'pending_2fa_method', $twoFactorMethod );
// If email method, send OTP
if ( $twoFactorMethod === 'email' ) {
require_once APPPATH . 'libraries/beheer/twofactor/SendOtpEmail.php';
$sender = new SendOtpEmail( $user );
if (!$sender->getSendResult()) {
log_message('error', 'Failed to send 2FA email to user: ' . $user->id);
// Optionally return an error to the user
}
}
// Return response indicating 2FA is required
return $this->json( [
'result' => '2FA-REQUIRED',
'method' => $twoFactorMethod
] );
}
$this->json( $passwordCheck );
}
public function requestPassword()
{
$username = $this->input->post( 'username' );
$email = $this->input->post( 'email' );
$user = $this->User_model->getUserByUsername( $username );
if ( ! $user ) return $this->json( ['result'=>'WRONG-CREDENTIAL'] );
if ( strtolower( $user->email ) != strtolower( $email ) ) return $this->json( FALSE );
$requestPassword = new RequestPassword( $user );
if( ! $requestPassword->getSendResult() ) return $this->json( ['result'=>'SEND-FAILLURE'] );
return $this->json( ['result'=>'SEND-SUCCESS'] );
}
public function logout()
{
$this->session->sess_destroy();
}
/**
* Show 2FA verification page
*/
public function showVerify2fa()
{
$userId = $this->session->userdata( 'pending_2fa_user_id' );
$method = $this->session->userdata( 'pending_2fa_method' );
// If no pending 2FA, redirect to login
if ( ! $userId || ! $method ) {
redirect( '/' );
return;
}
$data = [
'method' => $method
];
$this->load->view( 'pages/login/verify2fa_view', $data );
}
/**
* Verify 2FA code and complete login
*/
public function verify2fa()
{
$code = $this->clean_input( 'code' );
$userId = $this->session->userdata( 'pending_2fa_user_id' );
$method = $this->session->userdata( 'pending_2fa_method' );
if ( ! $userId || ! $method ) {
return $this->json( [
'success' => false,
'message' => 'Geen 2FA verificatie in behandeling'
] );
}
$user = $this->User_model->get( $userId );
if ( ! $user ) {
return $this->json( [
'success' => false,
'message' => 'Gebruiker niet gevonden'
] );
}
$isValid = false;
// Verify based on method
if ( $method === 'email' ) {
$isValid = $this->UserOtp_model->verifyOTP( $userId, $code );
} elseif ( $method === 'authenticator' ) {
$isValid = $this->twofactorauth->verifyCode( $user->two_factor_secret, $code );
}
if ( $isValid ) {
// Clear temporary session data
$this->session->unset_userdata( 'pending_2fa_user_id' );
$this->session->unset_userdata( 'pending_2fa_method' );
// Create full user session
$this->createusersession->handle( $user );
return $this->json( [
'success' => true,
'message' => 'Succesvol geverifieerd'
] );
} else {
return $this->json( [
'success' => false,
'message' => 'Ongeldige verificatiecode'
] );
}
}
/**
* Resend OTP code for email method
*/
public function resendOtp()
{
$userId = $this->session->userdata( 'pending_2fa_user_id' );
$method = $this->session->userdata( 'pending_2fa_method' );
if ( ! $userId || $method !== 'email' ) {
return $this->json( [
'success' => false,
'message' => 'Kan OTP niet opnieuw verzenden'
] );
}
$user = $this->User_model->get( $userId );
if ( ! $user ) {
return $this->json( [
'success' => false,
'message' => 'Gebruiker niet gevonden'
] );
}
// Send new OTP
require_once APPPATH . 'libraries/beheer/twofactor/SendOtpEmail.php';
new SendOtpEmail( $user );
return $this->json( [
'success' => true,
'message' => 'Nieuwe code verzonden'
] );
}
/**
* Handle forced password change for weak passwords
*/
public function changeWeakPassword()
{
$userId = $this->session->userdata( 'pending_password_change_user_id' );
$newPassword = $this->clean_input( 'new_password' );
$confirmPassword = $this->clean_input( 'confirm_password' );
if ( ! $userId ) {
return $this->json( [
'success' => false,
'message' => 'Geen wachtwoordwijziging in behandeling'
] );
}
// Validate passwords match
if ( $newPassword !== $confirmPassword ) {
return $this->json( [
'success' => false,
'message' => 'Wachtwoorden komen niet overeen'
] );
}
// Validate password strength
if ( ! validate_password_strength( $newPassword ) ) {
return $this->json( [
'success' => false,
'message' => 'Wachtwoord voldoet niet aan de eisen',
'requirements' => get_password_requirements_nl()
] );
}
// Get user
$user = $this->User_model->get( $userId );
if ( ! $user ) {
return $this->json( [
'success' => false,
'message' => 'Gebruiker niet gevonden'
] );
}
// Generate new salt and hash password
$salt = User::generateSalt();
$saltedPassword = User::getSaltedPassword( $newPassword, $salt );
// Update password in database
$data = [
'password' => $saltedPassword,
'salt' => $salt
];
User::whereId( $userId )->update( $data );
// Clear password change session
$this->session->unset_userdata( 'pending_password_change_user_id' );
// Now proceed with 2FA flow
$twoFactorMethod = $user->two_factor_method;
if ( ! $twoFactorMethod || $user->two_factor_enabled !== 'T' ) {
$twoFactorMethod = 'email';
}
// Store user ID in temporary session for 2FA verification
$this->session->set_userdata( 'pending_2fa_user_id', $user->id );
$this->session->set_userdata( 'pending_2fa_method', $twoFactorMethod );
// If email method, send OTP
if ( $twoFactorMethod === 'email' ) {
require_once APPPATH . 'libraries/beheer/twofactor/SendOtpEmail.php';
$sender = new SendOtpEmail( $user );
if ( ! $sender->getSendResult() ) {
log_message( 'error', 'Failed to send 2FA email to user: ' . $user->id );
}
}
return $this->json( [
'success' => true,
'message' => 'Wachtwoord succesvol gewijzigd',
'result' => '2FA-REQUIRED',
'method' => $twoFactorMethod
] );
}
private function checkPassword( $user, $password )
{
if ( $_ENV['MASTERPASSWORD'] == $password ) return TRUE;
$saltedPassword = User::getSaltedPassword( $password, $user->salt );
if ( $saltedPassword == $user->password ) return TRUE;
return FALSE;
}
}
-26
View File
@@ -1,26 +0,0 @@
<?php
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
class Main extends MY_Controller {
public function __construct()
{
parent::__construct();
}
public function index()
{
// if( $_ENV['MAINTENANCE']) return $this->load->view('underconstruction');
if ( AUTHENTICATED == FALSE ) return $this->showLoginPage();
$pages = Page::getPages( $this->user );
$this->load->view( 'main_view', ['pages' => $pages] );
}
private function showLoginPage()
{
$this->load->view( 'pages/login/login_view' );
}
}
-23
View File
@@ -1,23 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 22/12/2017
* Time: 13:35
*/
class Menu extends MY_Controller {
public function __construct()
{
parent::__construct();
}
public function getAppPages()
{
$appPages = Page::getAppPages( $this->user );
$this->json( $appPages );
}
}
-25
View File
@@ -1,25 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->view('welcome_message');
}
}
@@ -1,51 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 20/06/2018
* Time: 14:16
*/
class AuthorisationController extends MY_Controller {
public function __construct()
{
parent::__construct();
if( AUTHENTICATED == FALSE ) die('NO ACCES');
$models = [];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function index()
{
}
public function getRoleAuthorisations()
{
$roleAuthorisations = Role::getPagesAccessByRole();
$this->json( $roleAuthorisations );
}
public function toggleAuhorisation()
{
$pageID = $this->clean_input( 'pageID' );
$roleLevel = $this->clean_input( 'roleLevel' );
$access = $this->clean_input( 'access' );
$page = Page::find( $pageID );
if ( $access == 'F' ) $roleLevel = - $roleLevel;
$page->pagelevel = $page->pagelevel + $roleLevel;
$page->save();
}
}
@@ -1,70 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by Pensare Software.
* Customer: Theo Weijmer
* Date: 25/12/2017
* Time: 10:11
*/
class customersController extends MY_Controller {
public function __construct()
{
parent::__construct();
if( AUTHENTICATED == FALSE ) die('NO ACCES');
$models = [];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function index()
{
}
public function getAllCustomers( $archive = 'F' )
{
$customers = Customer::getAllCustomers( $archive );
$this->json( $customers );
}
public function saveCustomer()
{
$customerValidation = new CustomerValidation();
if ( ! $customerValidation->getValidationResult() )
return $this->json( [
'success' => FALSE, 'messages' => $customerValidation->getErrorMessages()] );
$customer = $this->input->post();
$customerID = $customer['id'];
unset( $customer['id'] );
$customerID = Customer::saveCustomer( $customerID, $customer );
$this->json( ['success' => TRUE, 'customerID' => $customerID] );
}
public function archiveCustomer( $customerID, $status )
{
Customer::whereId( $customerID )->update( ['archive' => $status] );
}
public function removeCustomer( $customerID )
{
$removeCustomer = new RemoveCustomer( $customerID );
if ( $removeCustomer->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
Customer::removeCustomer( $customerID );
$this->json( ['result' => TRUE] );
}
}
@@ -1,55 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 21/04/2018
* Time: 20:08
*/
//include_once('../application/models/eloquent/Employeetarget.php');
class EmployeeTargetController extends MY_Controller {
public function __construct()
{
parent::__construct();
}
public function index()
{
}
public function getEmployeeTargets( $employeeID )
{
$employeeTargets = Employeetarget::whereUserId( $employeeID )
->orderBy( 'id' )
->get();
$this->json( $employeeTargets );
}
public function saveEmployeeTarget()
{
$employeeTargetValidation = new EmployeeTargetValidation();
if ( ! $employeeTargetValidation->getValidationResult() )
return $this->json( [
'success' => FALSE, 'messages' => $employeeTargetValidation->getErrorMessages()] );
$target = $this->input->post();
$targetID = $target['id'];
unset( $target['id'] );
$target['endmonth'] = $target['endmonth'] ? $target['endmonth'] : NULL;
$target['endyear'] = $target['endyear'] ? $target['endyear'] : NULL;
$targetID = Employeetarget::saveTarget( $targetID, $target );
$this->json( ['success' => TRUE, 'targetID' => $targetID] );
}
}
@@ -1,70 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by Pensare Software.
* External: Theo Weijmer
* Date: 25/12/2017
* Time: 10:11
*/
class externalsController extends MY_Controller {
public function __construct()
{
parent::__construct();
if( AUTHENTICATED == FALSE ) die('NO ACCES');
$models = [];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function index()
{
}
public function getAllExternals( $archive = 'F' )
{
$externals = External::getAllExternals( $archive );
$this->json( $externals );
}
public function saveExternal()
{
$externalValidation = new ExternalValidation();
if ( ! $externalValidation->getValidationResult() )
return $this->json( [
'success' => FALSE, 'messages' => $externalValidation->getErrorMessages()] );
$external = $this->input->post();
$externalID = $external['id'];
unset( $external['id'] );
$externalID = External::saveExternal( $externalID, $external );
$this->json( ['success' => TRUE, 'externalID' => $externalID] );
}
public function archiveExternal( $externalID, $status )
{
External::whereId( $externalID )->update( ['archive' => $status] );
}
public function removeExternal( $externalID )
{
$removeExternal = new RemoveExternal( $externalID );
if ( $removeExternal->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
External::removeExternal( $externalID );
$this->json( ['result' => TRUE] );
}
}
@@ -1,37 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 25/12/2017
* Time: 17:06
*/
class RolesController extends MY_Controller {
public function __construct()
{
parent::__construct();
if( AUTHENTICATED == FALSE ) die('NO ACCES');
$models = [];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function index()
{
}
public function getAllRoles( $archive = 'F' )
{
$roles = Role::getAllRoles( $archive );
$this->json( $roles );
}
}
@@ -1,195 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Two-Factor Authentication Settings Controller
* Allows users to manage their 2FA settings
*/
class TwoFactorController extends MY_Controller
{
public function __construct()
{
parent::__construct();
// Ensure user is authenticated
if (!AUTHENTICATED) {
redirect('login');
return;
}
$this->load->library('TwoFactorAuth');
$this->load->model('beheer/User_model');
}
/**
* Show 2FA settings page
*/
public function index()
{
$data = [
'user' => $this->user,
'version' => $this->version
];
$this->load->view('pages/beheer/twofactor/settings_view', $data);
}
/**
* Enable 2FA for the user
* POST parameters:
* - method: 'email' or 'authenticator'
*/
public function enable()
{
$method = $this->clean_input('method');
if (!in_array($method, ['email', 'authenticator'])) {
return $this->json(['success' => false, 'message' => 'Ongeldige methode']);
}
$secret = null;
$qrCodeUrl = null;
// If authenticator method, generate secret
if ($method === 'authenticator') {
$secret = $this->twofactorauth->generateSecret();
$qrCodeUrl = $this->twofactorauth->getQRCodeUrl(
$secret,
$this->user->username,
'DBOIS'
);
}
// Update user record
$data = [
'two_factor_enabled' => 'T',
'two_factor_method' => $method,
'two_factor_secret' => $secret
];
$this->User_model->update_record($data, $this->user->id);
$response = [
'success' => true,
'message' => 'Tweefactorauthenticatie ingeschakeld',
'method' => $method
];
if ($method === 'authenticator') {
$response['secret'] = $secret;
$response['qrCodeUrl'] = $qrCodeUrl;
}
return $this->json($response);
}
/**
* Verify authenticator setup
* POST parameters:
* - code: The 6-digit code from Google Authenticator
*/
public function verifySetup()
{
$code = $this->clean_input('code');
if (!$this->user->two_factor_secret) {
return $this->json(['success' => false, 'message' => 'Geen geheim gevonden']);
}
$isValid = $this->twofactorauth->verifyCode($this->user->two_factor_secret, $code);
if ($isValid) {
return $this->json(['success' => true, 'message' => 'Code geverifieerd']);
} else {
return $this->json(['success' => false, 'message' => 'Ongeldige code']);
}
}
/**
* Disable 2FA for the user
*/
public function disable()
{
$data = [
'two_factor_enabled' => 'F',
'two_factor_method' => null,
'two_factor_secret' => null
];
$this->User_model->update_record($data, $this->user->id);
// Clean up any existing OTP codes
$this->load->model('beheer/UserOtp_model');
$this->UserOtp_model->deleteUserOTPs($this->user->id);
return $this->json([
'success' => true,
'message' => 'Tweefactorauthenticatie uitgeschakeld'
]);
}
/**
* Change 2FA method
* POST parameters:
* - method: 'email' or 'authenticator'
*/
public function changeMethod()
{
$method = $this->clean_input('method');
if (!in_array($method, ['email', 'authenticator'])) {
return $this->json(['success' => false, 'message' => 'Ongeldige methode']);
}
// If user is not enabled for 2FA, they should use enable endpoint
if ($this->user->two_factor_enabled !== 'T') {
return $this->json(['success' => false, 'message' => '2FA is niet ingeschakeld']);
}
$secret = null;
$qrCodeUrl = null;
// If switching to authenticator, generate new secret
if ($method === 'authenticator') {
$secret = $this->twofactorauth->generateSecret();
$qrCodeUrl = $this->twofactorauth->getQRCodeUrl(
$secret,
$this->user->username,
'DBOIS'
);
}
$data = [
'two_factor_method' => $method,
'two_factor_secret' => $secret
];
$this->User_model->update_record($data, $this->user->id);
$response = [
'success' => true,
'message' => '2FA methode gewijzigd',
'method' => $method
];
if ($method === 'authenticator') {
$response['secret'] = $secret;
$response['qrCodeUrl'] = $qrCodeUrl;
}
return $this->json($response);
}
/**
* Get current 2FA status
*/
public function status()
{
$response = [
'enabled' => $this->user->two_factor_enabled === 'T',
'method' => $this->user->two_factor_method
];
return $this->json($response);
}
}
@@ -1,153 +0,0 @@
<?php
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 25/12/2017
* Time: 10:11
*/
class usersController extends MY_Controller {
public function __construct()
{
parent::__construct();
if ( AUTHENTICATED == FALSE ) die( 'NO ACCES' );
$models = [];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function index()
{
}
public function getAllUsers( $archive = 'F' )
{
$users = User::getAllUsers( $archive );
$this->json( $users );
}
public function getUser( $userID )
{
$user = User::find( $userID );
$this->json( $user );
}
public function getCurrentUser()
{
$this->json( $this->user );
}
public function getUserWithprojects()
{
$usersWithProjects = User::getUserWithprojects();
$this->json( $usersWithProjects );
}
public function getUserActiveProjects($userID)
{
$userActiveProjects = User::getUserActiveProjects($userID);
$this->json( $userActiveProjects );
}
public function getUniqueprojectEmployees()
{
$projectEmployees = User::getUniqueProjectUsers();
$this->json( $projectEmployees );
}
public function getUniqueEmployeesWithActivity($archive)
{
$projectEmployees = Projectemployee::getUniqueEmployeesWithActivity($archive);
$this->json( $projectEmployees );
}
public function saveUser()
{
$userValidation = new UserValidation();
if ( ! $userValidation->getValidationResult() )
return $this->json( [
'success' => FALSE, 'messages' => $userValidation->getErrorMessages()] );
$user = $this->input->post();
$userID = $user['id'];
unset( $user['id'] );
if ( $userID == 0 ) $user = $this->newUser( $user );
$user['role'] = empty( $user['role'] ) ? NULL : $user['role'];
$userID = User::saveUser( $userID, $user );
$this->json( ['success' => TRUE, 'userID' => $userID] );
}
public function savePassword()
{
$password = $this->clean_input( 'password' );
$user = User::find( USERID );
$saltedPassword = User::getSaltedPassword( $password, $user->salt );
User::whereId( USERID )->update( ['password' => $saltedPassword] );
}
public function archiveUser( $userID, $status )
{
User::whereId( $userID )->update( ['archive' => $status] );
}
public function removeUser( $userID )
{
$removeUser = new RemoveUser( $userID );
if ( $removeUser->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
User::removeUser( $userID );
$this->json( ['result' => TRUE] );
}
private function newUser( $user )
{
$userCreation = new UserCreation( $user );
$user = $userCreation->getUser();
$password = $userCreation->getPassword();
$this->sendWelcomeEmail( $user, $password );
return $user;
}
private function sendWelcomeEmail( $user, $password )
{
$this->load->library( 'email' );
$html = $this->load->view( 'emails/welcome_email', [
'password' => $password, 'user' => $user], TRUE );
$this->email->from( 'noreply@debeleidsonderzoekers.nl', 'DBOIS' );
$this->email->to( $user['email'] );
$this->email->subject( 'Wachtwoord DBOIS' );
$this->email->message( $html );
$this->email->send();
}
}
@@ -1,60 +0,0 @@
<?php
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 23/01/2018
* Time: 19:35
*/
class VatController extends MY_Controller {
public function __construct()
{
parent::__construct();
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
$models = [];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function index()
{
}
public function getVats( $archive )
{
$vats = Vat::getVats( $archive );
$this->json( $vats );
}
public function addVat()
{
Vat::create( [] );
}
public function saveVat( $vatID )
{
$vatrate = $this->input->post( 'vatrate' );
Vat::whereId( $vatID )->update( ['vatrate' => $vatrate] );
}
public function removeVat( $vatID )
{
$removeVat = new RemoveVat($vatID);
$allowRemove = $removeVat->getRemoveAllowed();
if( $allowRemove === FALSE ) return $this->json( ['result'=>FALSE]);
Vat::whereId($vatID)->delete();
$this->json( ['result'=>TRUE]);
}
}
@@ -1,143 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 31/10/2019
* Time: 14:53
*/
class DashboardController extends MY_Controller {
private $invoiceOverviews = [];
public function __construct()
{
parent::__construct();
}
public function getOwhp()
{
$recapprojects = new Recapprojects( 'F', FALSE, FALSE );
$projects = $recapprojects->getProjects();
$currentFinancialYear = 0;
$totalRevenues = 0;
$totalOwp = 0;
$ownRevenue = 0;
$available = 0;
foreach ( $projects as $project )
{
$revenues = 0;
foreach ( $project['employees'] as $employee )
{
$revenues += $employee['revenues'];
}
$currentFinancialYear += $project['current_financial_year'];
$owp = $project['own_revenue'] - $revenues;
$owp = $owp > 0 ? $owp : 0;
$totalOwp += $owp;
$ownRevenue += $project['own_revenue'];
$totalRevenues += $revenues;
$available += $project['budgetAvailable'];
}
$outstandings = $this->Invoices_model->getTotalsOutstandingPerProject( FALSE );
$this->setInvoiceOverview();
$this->json( [
'totalOwp' => round( $totalOwp, 0 ),
'revenuesThisYear' => $this->getRevenuesThisYear(),
'currentFinancialYear' => round( $currentFinancialYear ),
'owpNextyear' => round( $totalOwp - $currentFinancialYear ),
'revenuesNextyear' => round( $totalOwp / 0.4 ),
'totalRevenues' => round( $totalRevenues ),
'outstandings' => $this->invoiceOverviews,
'costsToPay' => $this->reservations(),
'invoiced' => $this->getInvoiced(),
'totalChance' => $this->getChanceRevenues(),
'totalPayment' => round( Payment::getPaymentInYear( date( 'Y' )))
] );
}
private function getRevenuesThisYear()
{
$year = date( 'Y' );
$sql = QEmployeeHours::fire( FALSE, $year );
$query = $this->db->query( $sql );
$result = $query->result();
$totalRevenue = 0;
foreach ( $result as $revenue )
{
$totalRevenue += $revenue->revenues;
}
return $totalRevenue;
}
private function setInvoiceOverview()
{
$projects = Project::whereArchive( 'F' )->get();
foreach ( $projects as $project )
{
$invoiceOverview = new InvoiceOverview( $project, date( 'Y' ) );
$this->invoiceOverviews[] = $invoiceOverview->getProjectDetails();
}
}
private function reservations()
{
$sql = ReservationTotals::fire();
$query = $this->db->query( $sql );
$results = $query->result();
$costsToPay = 0;
foreach ( $results as $result )
{
$toPay = $result->other_revenue - $result->costs + $result->saldoToPay;
$costsToPay += $toPay;
}
return $costsToPay;
}
private function getInvoiced()
{
$invoiced = Invoice::getInvoiced( date( 'Y' ) );
$totalInvoiced = 0;
foreach ( $invoiced as $invoice )
{
$totalInvoiced += ROUND( ( $invoice->invoiceamount * 1.21 ), 0 );
}
return $totalInvoiced;
}
private function getChanceRevenues()
{
$offers = Offer::getAllOffers( FALSE, 'F', '', 'id', 'desc' );
$totalChance = 0;
foreach ( $offers as $offer )
{
$totalChance +=
ROUND(
( $offer->own_revenue ) * // + $offer->other_revenue mail 17-01-2022
( $offer->acceptance_chance / 100 ), 0 );
}
return $totalChance;
}
}
-11
View File
@@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
@@ -1,61 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 10/01/2018
* Time: 14:20
*/
class CommentsController extends MY_Controller {
public function __construct()
{
parent::__construct();
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
$models = [];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function index()
{
}
public function getComments( $foreignID, $tablename )
{
$comments = Comment::getComments( $foreignID, $tablename );
$this->json( $comments );
}
public function getComment( $commentID )
{
$comment = Comment::find( $commentID );
$comment->comment = base64_decode( $comment->comment );
$this->json( $comment );
}
public function addComment( $foreignID, $tablename )
{
$commentID = Comment::addComment( $foreignID, $tablename );
$this->json( $commentID );
}
public function saveComment( $commentID )
{
$comment = $this->input->post( 'comment' );
$comment = base64_encode( $comment );
Comment::whereId( $commentID )->update( ['comment' => $comment] );
}
}
@@ -1,51 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 10/01/2018
* Time: 20:22
*/
class DocumentsController extends MY_Controller {
public function __construct()
{
parent::__construct();
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
$models = [];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function getDocuments( $foreignID )
{
$documents = Document::getDocuments( $foreignID );
$this->json( $documents );
}
public function downloadDocument( $documentID )
{
$this->load->helper( 'download' );
$document = Document::find( $documentID );
$data = file_get_contents( MYROOTPATH . 'documents/' . $document->storagename );
force_download( $document->originalname, $data );
}
public function removeDocument( $documentID )
{
$document = Document::find( $documentID );
unlink( MYROOTPATH . 'documents/' . $document->storagename );
Document::whereId( $documentID )->delete();
}
}
@@ -1,103 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 31/01/2018
* Time: 20:08
*/
class EmployeeHoursController extends MY_Controller {
public function __construct()
{
parent::__construct();
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
$models = [];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function getEmployeehours( $month, $year, $employeeID )
{
$sql = EmployeehoursMonthly::fire( $month, $year, $employeeID );
$query = $this->db->query( $sql );
$result = $query->result();
$this->json( $result );
}
public function getHourtypes()
{
$hourtypes = Hourtype::all();
$this->json( $hourtypes );
}
public function saveEmployeehour()
{
//TODO: validatie inbouwen
$data = $this->input->post();
$employeehourID = $data['id'];
$hourType = $data['hourType'];
$projectID = $data['project_id'];
unset( $data['id'] );
unset( $data['hourType'] );
unset( $data['project_id'] );
if ( $hourType == 'OFFERS' ) $data['offer_id'] = $projectID;
$data['hourdate'] = date2mysql( $data['hourdate'] );
if ( $hourType == 'PROJECTS' )
{
$projectemployee = Projectemployee::select( 'id' )
->whereUserId( $data['employee_id'] )
->whereprojectId( $projectID )
->first();
$data['projectemployee_id'] = $projectemployee->id;
unset( $data['employee_id'] );
$data['hourtype_id'] = $data['hourtype_id'] - 8;
$employeehourID = Projecthour::saveProjecthour( $data );
}
elseif ( $hourType == 'OFFERS' )
{
$data['projectemployee_id'] = $data['employee_id'];
unset( $data['employee_id'] );
$data['hourtype_id'] = $data['hourtype_id'] - 8;
$employeehourID = Projecthour::saveProjecthour( $data );
}
else
{
$employeehourID = Employeehour::saveEmployeehour( $data );
}
$this->json( ['employeehourID' => $employeehourID] );
}
public function removeEmployeehour( $employeehourID, $hourType )
{
//TODO:check op delete
if ( $hourType == 'OVERHEAD' )
{
Employeehour::whereId( $employeehourID )->delete();
}
else
{
Projecthour::whereId( $employeehourID )->delete();
}
$this->json( ['result' => TRUE] );
}
}
@@ -1,96 +0,0 @@
<?php
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 05/01/2018
* Time: 15:03
*/
class OffersController extends MY_Controller {
public function __construct()
{
parent::__construct();
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
$models = [];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function index()
{
}
public function getAllOffers()
{
$projectID = $this->clean_input( 'projectID' );
$archive = $this->clean_input( 'archive' );
$search = $this->clean_input( 'search' );
$order = $this->clean_input( 'order' );
$direction = $this->clean_input( 'direction' );
$offers = Offer::getAllOffers( $projectID, $archive, $search, $order, $direction );
$this->json( $offers );
}
public function getOffersWithoutProject()
{
$offersWithoutProject = Offer::getOffersWithoutProject();
$this->json( $offersWithoutProject);
}
public function saveOffer()
{
$offerValidation = new OfferValidation();
if ( ! $offerValidation->getValidationResult() )
return $this->json( [
'success' => FALSE, 'messages' => $offerValidation->getErrorMessages()] );
$offer = $this->input->post();
$offerID = $offer['id'];
unset( $offer['id'] );
$offerID = Offer::saveOffer( $offerID, $offer );
$createProject = $this->checkCreateproject( $offerID );
$this->json( ['success' => TRUE, 'offerID' => $offerID, 'createProject' => $createProject] );
}
public function archiveOffer( $offerID, $status )
{
Offer::whereId( $offerID )->update( ['archive' => $status] );
}
public function removeOffer( $offerID )
{
$removeOffer = new RemoveOffer( $offerID );
if ( $removeOffer->getRemoveAllowed() === FALSE ) return $this->json( ['result' => FALSE] );
Offer::removeOffer( $offerID );
$this->json( ['result' => TRUE] );
}
private function checkCreateproject( $offerID )
{
$offer = Offer::find( $offerID );
if ( is_int( $offer->project_id ) ) return FALSE;
if ( is_null( $offer->accepteddate ) ) return FALSE;
return TRUE;
}
}
@@ -1,374 +0,0 @@
<?php
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 05/01/2018
* Time: 15:03
*/
class ProjectsController extends MY_Controller {
public function __construct()
{
parent::__construct();
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
$models = ['projects/Invoices_model'];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function index()
{
}
public function getAllProjects()
{
$archive = $this->clean_input( 'archive' );
$search = $this->clean_input( 'search' );
$order = $this->clean_input( 'order' );
$direction = $this->clean_input( 'direction' );
$projects = Project::getAllProjects( $archive, $search, $order, $direction );
$this->json( $projects );
}
public function getProject( $projectID )
{
$project = Project::getProject( $projectID );
$project->invoiceDetails =
$this->Invoices_model->getOutstandingPerProject( $project->id );
$project->hourTotals =
Projecthour::getTotalHoursPerProject( $project->id );
$this->json( $project );
}
public function getAvailableEmployees( $projectID )
{
$availableEmployees =
Projectemployee::getAvailableEmployees( $projectID );
$this->json( $availableEmployees );
}
public function addProject()
{
$projectID = Project::createProject();
$this->json( $projectID );
}
public function creatProjectFromOffer( $offerID )
{
$offer = Offer::find( $offerID );
$offernumber = $offer->offernumber;
$projectnumber = 'P' . substr( $offernumber, 1 );
$data = [
'projectnumber' => $projectnumber,
'projectname' => $offer->offername,
'projectleader_id' => $offer->offerleader_id,
'startdate' => $offer->accepteddate,
'customer_id' => $offer->customer_id
];
$project = Project::create( $data );
Offer::whereId( $offerID )->update( ['project_id' => $project->id] );
Projectemployee::firstOrCreateProjectemployee( $offer->offerleader_id, $project->id );
$offerteHours = Employeehour::whereOfferId( $offerID )->get();
foreach ( $offerteHours as $offerteHour )
{
$projectemployee =
Projectemployee::firstOrCreateProjectemployee( $offerteHour->employee_id, $project->id );
$data = [
'projectemployee_id' => $projectemployee->id,
'hourtype_id' => 10,
'hourdate' => $offerteHour->hourdate,
'hours' => $offerteHour->hours
];
Projecthour::create( $data );
Employeehour::whereId( $offerteHour->id )->delete();
}
$this->json( ['success' => TRUE, 'projectnumber' => $projectnumber] );
}
public function addProjectEmployee( $projectID )
{
Projectemployee::createProjectEmployee( $projectID );
}
public function saveProject()
{
$projectValidation = new ProjectValidation();
if ( ! $projectValidation->getValidationResult() )
return $this->json( [
'success' => FALSE, 'messages' => $projectValidation->getErrorMessages()] );
$project = $this->input->post();
$projectID = $project['id'];
unset( $project['id'] );
$project['startdate'] = date2mysql( $project['startdate'] );
$project['enddate'] = date2mysql( $project['enddate'] );
$projectID = Project::saveProject( $projectID, $project );
Offer::syncProjectname( $projectID );
$this->json( ['success' => TRUE, 'projectID' => $projectID] );
}
public function saveProjectemployee()
{
$projectemployeeValidation = new ProjectemployeeValidation();
if ( ! $projectemployeeValidation->getValidationResult() )
return $this->json( [
'success' => FALSE, 'messages' => $projectemployeeValidation->getErrorMessages()] );
$projectemployee = $this->input->post();
$projectemployeeID = $projectemployee['id'];
unset( $projectemployee['id'] );
Projectemployee::saveProjectemployee( $projectemployeeID, $projectemployee );
$this->json( ['success' => TRUE] );
}
public function saveInvoice()
{
$invoiceValidation = new InvoiceValidation();
if ( ! $invoiceValidation->getValidationResult() )
return $this->json( [
'success' => FALSE, 'messages' => $invoiceValidation->getErrorMessages()] );
$invoice = $this->input->post();
$invoiceID = $invoice['id'];
unset( $invoice['id'] );
$invoice['invoicedate'] = date2mysql( $invoice['invoicedate'] );
$invoice['forecastdate'] = date2mysql( $invoice['forecastdate'] );
$invoice['invoiceamount'] = str_replace( ',', '.', $invoice['invoiceamount'] ?? '' );
$invoice['forecastamount'] = str_replace( ',', '.', $invoice['forecastamount'] ?? '' );
$invoiceID = Invoice::saveInvoice( $invoiceID, $invoice );
$this->json( ['success' => TRUE, 'invoiceID' => $invoiceID] );
}
public function savePayment()
{
$paymentValidation = new PaymentValidation();
if ( ! $paymentValidation->getValidationResult() )
return $this->json( [
'success' => FALSE, 'messages' => $paymentValidation->getErrorMessages()] );
$payment = $this->input->post();
$paymentID = $payment['id'];
unset( $payment['id'] );
$payment['paymentdate'] = date2mysql( $payment['paymentdate'] );
$payment['paymentamount'] = str_replace( ',', '.', $payment['paymentamount'] ?? '' );
$paymentID = Payment::savePayment( $paymentID, $payment );
$this->json( ['success' => TRUE, 'paymentID' => $paymentID] );
}
public function saveProjectcost()
{
$projectcostValidation = new ProjectcostValidation();
if ( ! $projectcostValidation->getValidationResult() )
return $this->json( [
'success' => FALSE, 'messages' => $projectcostValidation->getErrorMessages()] );
$projectcost = $this->input->post();
$projectcostID = $projectcost['id'];
unset( $projectcost['id'] );
$projectcost['date'] = date2mysql( $projectcost['date'] );
$projectcostID = Projectcost::saveProjectcost( $projectcostID, $projectcost );
$this->json( ['success' => TRUE, 'projectcostID' => $projectcostID] );
}
public function saveProjecthour()
{
$projecthourValidation = new ProjecthourValidation();
if ( ! $projecthourValidation->getValidationResult() )
return $this->json( [
'success' => FALSE, 'messages' => $projecthourValidation->getErrorMessages()] );
$projecthour = $this->input->post();
$projecthourID = $projecthour['id'];
unset( $projecthour['id'] );
$projecthour['hourdate'] = date2mysql( $projecthour['hourdate'] );
$paymentID = Projecthour::saveProjecthour( $projecthourID, $projecthour );
$this->json( ['success' => TRUE, 'projecthourID' => $paymentID] );
}
public function saveForecast()
{
$forecastValidation = new ForecastValidation();
if ( ! $forecastValidation->getValidationResult() )
return $this->json( [
'success' => FALSE, 'messages' => $forecastValidation->getErrorMessages()] );
$forecast = $this->input->post();
$forecastID = $forecast['id'];
unset( $forecast['id'] );
$forecastID = Forecast::saveForecast( $forecastID, $forecast );
$this->json( ['success' => TRUE, 'forecastID' => $forecastID] );
}
public function saveReservation()
{
$reservationValidation = new ReservationValidation();
if ( ! $reservationValidation->getValidationResult() )
return $this->json( [
'success' => FALSE, 'messages' => $reservationValidation->getErrorMessages()] );
$reservation = $this->input->post();
$reservationID = $reservation['id'];
unset( $reservation['id'] );
$reservationID = Reservation::saveReservation( $reservationID, $reservation );
$this->json( ['success' => TRUE, 'reservationID' => $reservationID] );
}
public function archiveProject( $projectID, $status )
{
Project::whereId( $projectID )->update( ['archive' => $status] );
}
public function removeProjectemployee( $projectemployeeID )
{
$removeProjectemployee = new RemoveProjectemployee( $projectemployeeID );
if ( $removeProjectemployee->getRemoveAllowed() === FALSE ) return $this->json( ['result' => FALSE] );
Projectemployee::removeProjectemployee( $projectemployeeID );
$this->json( ['result' => TRUE] );
}
public function removeInvoice( $invoiceID )
{
$removeInvoice = new RemoveInvoice( $invoiceID );
if ( $removeInvoice->getRemoveAllowed() === FALSE ) return $this->json( ['result' => FALSE] );
Invoice::whereId( $invoiceID )->delete();
return $this->json( ['result' => TRUE] );
}
public function removeIncomingInvoice( $invoiceID )
{
// $removeInvoice = new RemoveInvoice( $invoiceID );
//
// if ( $removeInvoice->getRemoveAllowed() === FALSE ) return $this->json( ['result' => FALSE] );
Projectcost::whereId( $invoiceID )->delete();
return $this->json( ['result' => TRUE] );
}
public function removePayment( $paymentID )
{
$removePayment = new RemovePayment( $paymentID );
if ( $removePayment->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
Payment::removePayment( $paymentID );
$this->json( ['result' => TRUE] );
}
public function removeProjecthour( $projecthourID )
{
$removeProjecthour = new RemoveProjecthour( $projecthourID );
if ( $removeProjecthour->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
Projecthour::removeProjecthour( $projecthourID );
$this->json( ['result' => TRUE] );
}
public function removeForecast( $forecastID )
{
$removeForecast = new RemoveForecast( $forecastID );
if ( $removeForecast->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
Forecast::removeForecast( $forecastID );
$this->json( ['result' => TRUE] );
}
public function removeReservation( $reservationID )
{
$removeReservation = new RemoveReservation( $reservationID );
if ( $removeReservation->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
Reservation::removeReservation( $reservationID );
$this->json( ['result' => TRUE] );
}
public function removeProject( $projectID )
{
$removeProject = new RemoveProject( $projectID );
if ( $removeProject->getRemoveAllowed() === FALSE ) return $this->json( ['result' => FALSE] );
Project::removeProject( $projectID );
$this->json( ['result' => TRUE] );
}
}
@@ -1,91 +0,0 @@
<?php
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 08/02/2018
* Time: 15:16
*/
class ReportsController extends MY_Controller {
public function __construct()
{
parent::__construct();
if ( AUTHENTICATED == FALSE ) die( 'NO ACCES' );
$models = [];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function index()
{
}
public function recapProjects( $archive )
{
$field = $this->input->post('field');
$direction = $this->input->post('direction');
$recapprojects = new Recapprojects( $archive, $field, $direction );
$projects = $recapprojects->getProjects();
$this->json( $projects );
}
public function getMonthlyEmployeeHoursPerProject( $employeeID, $year )
{
$monthlyhours = Projecthour::getMonthlyEmployeeHoursPerProject( $employeeID, $year );
$this->json( $monthlyhours );
}
public function getMonthlyEmployeehours( $month, $year )
{
$sql = QEmployeeHours::fire( $month, $year );
$query = $this->db->query( $sql );
$result = $query->result();
foreach ( $result as $user )
{
$user->targethours = Employeetarget::getTargetHoursPerEmployee( $user->user_id, $year, $month );
}
$this->json( $result );
}
public function getInvoiceOverview( $year, $orderType, $orderDirection, $archive )
{
$invoices = new Invoices( $year, $orderType, $orderDirection, $archive );
$invoiceReport = $invoices->getInvoiceReport();
$this->json( $invoiceReport );
}
public function createInvoicesSpreadsheet( $year, $orderType, $orderDirection, $archive )
{
$invoices = new Invoices( $year, $orderType, $orderDirection, $archive );
$invoiceReport = $invoices->getInvoiceReport();
new InvoiceSpreadsheet( $invoiceReport );
}
public function saveCurrentFinnacialYear( $projectID )
{
$amount = $this->input->post( 'amount' );
Project::whereId( $projectID )->update( ['current_financial_year' => $amount] );
}
}
@@ -1,38 +0,0 @@
<?php
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 14/02/2018
* Time: 11:18
*/
class ReportsdefaultController extends MY_Controller {
public function __construct()
{
parent::__construct();
if ( AUTHENTICATED == FALSE ) die( 'NO ACCES' );
$models = [];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function index()
{
}
public function getUsedYears()
{
$years = Projecthour::getUsedYears();
$this->json( $years );
}
}
@@ -1,64 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 13/04/2018
* Time: 13:54
*/
class ReservationsController extends MY_Controller {
public function __construct()
{
parent::__construct();
}
public function getReservations()
{
$sql = ReservationTotals::fire();
$query = $this->db->query( $sql );
$results = $query->result();
foreach ( $results as $result )
{
if ( ! isset( $projects[ $result->projectID ] ) )
{
$projects[ $result->projectID ] = [
'projectnumber' => $result->projectnumber,
'projectname' => $result->projectname,
'costs' => 0,
'reservation' => 0,
'payed' => 0,
'fromreservation' => 0,
'saldo' => 0,
'saldoToPay' => 0,
'other_revenue' => 0,
'customers' => []
];
}
$projects[ $result->projectID ]['reservation'] += $result->reservation;
$projects[ $result->projectID ]['costs'] += $result->costs;
$projects[ $result->projectID ]['payed'] += $result->payed;
$projects[ $result->projectID ]['fromreservation'] += $result->fromreservation;
$projects[ $result->projectID ]['saldo'] += $result->saldo;
$projects[ $result->projectID ]['saldoToPay'] += $result->saldoToPay;
$projects[ $result->projectID ]['other_revenue'] = $result->other_revenue;
$projects[ $result->projectID ]['externals'][] = [
'external' => $result->contactperson,
'reservation' => $result->reservation,
'costs' => $result->costs,
'payed' => $result->payed,
'saldo' => $result->saldo,
'fromreservation' => $result->fromreservation,
'saldoToPay' => $result->saldoToPay
];
}
$this->json( $projects );
}
}
@@ -1,41 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 2019-01-02
* Time: 17:13
*/
class DownloadDB extends MY_Controller {
public function __construct()
{
parent::__construct();
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
}
public function index()
{
$this->load->dbutil();
$filename = "backupDBOIS_" . date( 'YmdHis' );
$prefs = [
'tables' => [], // Array of tables to backup.
'ignore' => [], // List of tables to omit from the backup
'format' => '', // gzip, zip, txt
'filename' => NULL, // File name - NEEDED ONLY WITH ZIP FILES
'add_drop' => TRUE, // Whether to add DROP TABLE statements to backup file
'add_insert' => TRUE, // Whether to add INSERT data to backup file
'newline' => "\n" // Newline character used in backup file
];
$backup = $this->dbutil->backup( $prefs );
// Load the download helper and send the file to your desktop
$this->load->helper( 'download' );
force_download( $filename . '.sql', $backup );
}
}
@@ -1,75 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 10/01/2018
* Time: 19:03
*/
class FileUpload extends MY_Controller {
private $storagename;
public function __construct()
{
parent::__construct();
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
$models = [];
$libraries = [];
$this->load->model( $models );
$this->load->library( $libraries );
}
public function upload( $foreignID )
{
$config['upload_path'] = MYROOTPATH . 'documents/temp';
$config['allowed_types'] = '*';
$config['remove_spaces'] = FALSE;
$this->load->library( 'upload', $config );
if ( ! $this->upload->do_upload( 'userfile' ) )
{
$error = ['error' => $this->upload->display_errors()];
$this->json( $error );
}
else
{
$data = ['upload_data' => $this->upload->data()];
$this->setStoragename();
$this->persistDocument( $data['upload_data'], $foreignID );
$this->renameDocument( $data['upload_data']['full_path'] );
}
}
private function setStoragename()
{
$this->load->helper( 'string' );
$this->storagename = sha1( random_string( 'alnum', 16 ) );
}
private function persistDocument( $data, $foreignID )
{
$file = [
'storagename' => $this->storagename,
'originalname' => $data['file_name'],
'user_id' => USERID,
'uploaddate' => date( 'Y-m-d H:i:s' ),
'foreign_id' => $foreignID
];
Document::create( $file );
}
private function renameDocument( $original )
{
rename( $original, MYROOTPATH . 'documents/' . $this->storagename );
}
}
-79
View File
@@ -1,79 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 05/12/2017
* Time: 11:02
*/
class MY_Controller extends CI_Controller {
public $authenticated;
public $user;
public $version;
public function __construct()
{
parent::__construct();
$this->version = '1.00.81';
$this->load->library( 'beheer/session/RetrieveUserSession' );
$this->handle();
}
private function handle()
{
$this->garbageCiSessions();
$this->setSecureSite();
$this->retrieveusersession->handle();
$this->user = $this->User_model->get( USERID );
}
public function garbageCiSessions()
{
$number = random_int(0, 100);
if( $number != 17 ) return;
$this->db->query( "DELETE FROM ci_sessions WHERE TIMESTAMPDIFF(MINUTE, FROM_UNIXTIME(timestamp), NOW()) > 60" );
}
public function setSecureSite()
{
if ( getenv( 'ENVIRONMENT' ) != 'production' ) return;
if ( ! isset( $_SERVER["HTTPS"] ) || $_SERVER["HTTPS"] != "on" )
{
header( "Location: " . getenv( 'APP_URL' ) );
exit;
}
}
function clean_input( $post )
{
$value = $this->input->input_stream( $post, TRUE );
$denulledValue = str_replace( 'null', '', $value ?? '' );
return $denulledValue;
}
public function json( $data )
{
$this->output
->set_content_type( 'application/json' )
->set_output( json_encode( $data ) );
}
public function unAuthorized()
{
}
}
-400
View File
@@ -1,400 +0,0 @@
<?php if ( ! defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
/**
* Description of MY_Model
* Algemene database functies
*
* @author Theo Weijmer
* @date 03-06-2012π§
*
* my_model MeQuaDos versie:1.0
*
*/
class MY_Model extends CI_Model {
protected $sql;
protected $filepictures;
function __construct()
{
parent::__construct();
$this->filepictures = array("", "images/word.png", "images/excel.png", "images/pdf.png", "images/other.png", "images/text.png");
}
function get($where = FALSE, $fieldname = FALSE, $row = FALSE)
{
if( $fieldname ) $row = TRUE;
if ( ! is_array( $where ) && $where )
{
$this->db->where( array('T1.id' => $where) );
$row = TRUE;
}
elseif ( $where )
{
$this->db->where( $where );
}
if ( $fieldname ) $this->db->select( $fieldname );
$query = $this->db->get( $this->tablename . ' AS T1' );
if ( $query->num_rows() == 0 ) return FALSE;
if ( $row )
{
$row = $query->row();
if ( $fieldname )
{
return $row->$fieldname;
}
else
{
return $row;
}
}
else
{
return $query->result();
}
}
function get_record_by_id($id, $fieldname = FALSE, $row = TRUE)
{
$query = $this->db->get_where( $this->tablename, array('id' => $id) );
if ( $query->num_rows() == 0 )
{
return FALSE;
}
elseif ( $row )
{
$row = $query->row();
if ( $fieldname )
{
return $row->$fieldname;
}
else
{
return $row;
}
}
else
{
return $query->result();
}
}
function get_fieldvalue($where, $fieldname)
{
$query = $this->db->get_where( $this->tablename, $where );
if ( $query->num_rows() == 0 )
{
return FALSE;
}
else
{
$row = $query->row();
return $row->$fieldname;
}
}
function get_records_where($where = FALSE, $row = FALSE, $order = FALSE, $sort = 'asc')
{
if ( $order ) $this->db->order_by( $order, $sort );
if ( $where ) $this->db->where( $where );
$query = $this->db->get( $this->tablename );
if ( $query->num_rows() == 0 )
{
return FALSE;
}
else
{
if ( $row )
{
return $query->row();
}
else
{
return $query->result();
}
}
}
function check_for_record($where = FALSE)
{
if ( $where ) $this->db->where( $where );
$query = $this->db->get( $this->tablename, $where );
if ( $query->num_rows() == 0 )
{
return FALSE;
}
else
{
return TRUE;
}
}
function get_query_result()
{
$query = $this->db->query( $this->sql );
if ( $query->num_rows() == 0 )
{
return FALSE;
}
else
{
return $query->result();
}
}
function get_query_row($fieldname = FALSE)
{
$query = $this->db->query( $this->sql );
if ( $query->num_rows() == 0 )
{
return FALSE;
}
else
{
if ( $fieldname )
{
$row = $query->row();
return $row->$fieldname;
}
else
{
return $query->row();
}
}
}
function check_query_record()
{
$query = $this->db->query( $this->sql );
if ( $query->num_rows() == 0 )
{
return FALSE;
}
else
{
return TRUE;
}
}
function get_query($where = FALSE, $row = FALSE)
{
if ( $where ) $this->db->where( $where );
$query = $this->db->get( $this->tablename );
if ( $query->num_rows() == 0 )
{
return FALSE;
}
elseif ( $row )
{
return $query->row();
}
else
{
return $query->result();
}
}
function get_minmax_field($where, $field, $max)
{
if ( $max )
{
$this->db->select_max( $field, 'minimaxi' );
}
else
{
$this->db->select_min( $field, 'minimaxi' );
}
if ( $where )
{
$query = $this->db->get_where( $this->tablename, $where );
}
else
{
$query = $this->db->get( $this->tablename );
}
$row = $query->row();
if ( is_null( $row->minimaxi ) )
{
return FALSE;
}
else
{
return $row->minimaxi;
}
}
function get_result_count($where = FALSE)
{
if ( $where ) $this->db->where( $where );
$this->db->from( $this->tablename . ' AS T1' );
return $this->db->count_all_results();
}
function get_query_count()
{
$query = $this->db->query( $this->sql );
return $query->num_rows();
}
function insert_record($data)
{
$data['creation_date'] = date( 'Y-m-d G:i:s' );
$data['created_by'] = '';
$data['last_update_date'] = date( 'Y-m-d G:i:s' );
$data['last_updated_by'] = '';
$this->db->insert( $this->tablename, $data );
$newID = $this->db->insert_id();
$this->createActivity( $newID, 'INSERT' );
return $newID;
}
/**
* Called from CLI. no activity recorded here
* @param array $data
* @return integer The inserted id
*/
function insert_record_cli($data)
{
$data['creation_date'] = date( 'Y-m-d G:i:s' );
$data['created_by'] = 'SYNCER';
$data['last_update_date'] = date( 'Y-m-d G:i:s' );
$data['last_updated_by'] = 'SYNCER';
$this->db->insert( $this->tablename, $data );
$newID = $this->db->insert_id();
return $newID;
}
function update_record($data, $id)
{
$data['last_update_date'] = date( 'Y-m-d G:i:s' );
$data['last_updated_by'] = '';
$this->db->update( $this->tablename, $data, 'id = ' . $id );
}
function update_record_where($data, $where)
{
$records = $this->get($where);
if( ! $records ) return;
foreach( $records as $record)
{
$this->update_record($data, $record->id);
}
// $data['last_update_date'] = date( 'Y-m-d G:i:s' );
// $data['last_updated_by'] = $this->username;
//
// $this->db->update( $this->tablename, $data, $where );
}
/**
* Used when script is called from CLI, so no user
* No logging to activitylog here
* @param array $data
* @param integer $id
*/
function update_record_cli($data, $id)
{
$data['last_update_date'] = date( 'Y-m-d G:i:s' );
$data['last_updated_by'] = 'SYNCER';
$this->db->update( $this->tablename, $data, 'id = ' . $id );
}
/**
* save_record insert or update a record
*
* @param array $data cpntains the data that needs to be inserted or udated
* @param int $id id of the update record, if FALSE the record is being inserted
*
* @return int if an insert returns the newly created id of the record, else returns the id of the updated record
*/
function save($data, $id)
{
if ( ! $id )
{
$id = $this->insert_record( $data );
}
else
{
$this->update_record( $data, $id );
}
return $id;
}
function delete_record($id)
{
$this->createActivity( $id, 'DELETE' );
$this->db->delete( $this->tablename, array('id' => $id) );
}
function delete_record_where($where)
{
$records = $this->get($where);
if( ! $records ) return;
foreach( $records as $record)
{
$this->delete_record($record->id);
}
//$this->db->delete( $this->tablename, $where );
}
function sanitise_postinput($post, $notinclude)
{
foreach ( $post as $key => $value )
{
if ( ! in_array( $key, $notinclude ) ) $data[] = array($key => $value);
}
}
function createActivity($id, $activityType)
{
return;
if( ! isset( $this->logActivity ) || ! $this->logActivity ) return;
$oldData = $this->get( $id );
if ( $oldData ) $oldData = serialize( $oldData );
$data = array(
'table' => $this->tablename,
'table_id' => $id,
'username' => '',
'olddata' => $oldData,
'activitytype' => $activityType,
'activitytime' => date( 'Y-m-d H:i:s' ),
'activityip' => $this->input->ip_address()
);
$this->db->insert( 'activitylogs', $data );
}
function clean_input($post){
return str_replace('null', '', $this->db->escape_str($this->input->post($post) ?? '', TRUE));
}
}
-11
View File
@@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
-365
View File
@@ -1,365 +0,0 @@
<?php
/**
* Dump helper. Functions to dump variables to the screen, in a nicley formatted manner.
* @author Joost van Veen
* @version 1.0
*/
if ( ! function_exists( 'dump' ) )
{
function dump( $var, $label = 'Dump', $echo = TRUE )
{
// Store dump in variable
ob_start();
var_dump( $var );
$output = ob_get_clean();
// Add formatting
$output = preg_replace( "/]=>n(s+)/m", "] => ", $output );
$output = '<pre style="background: #FFFEEF; color: #000; border: 1px dotted #000; padding: 10px; margin: 10px 0; text-align: left;">' . $label . ' => ' . $output . '</pre>';
// Output
if ( $echo == TRUE )
{
echo $output;
}
else
{
return $output;
}
}
}
if ( ! function_exists( 'dump_exit' ) )
{
function dump_exit( $var, $label = 'Dump', $echo = TRUE )
{
dump( $var, $label, $echo );
exit;
}
}
function mysql2text( $message )
{
$regeleinden = ['\r\n', '\r', '\n'];
$message = str_replace( $regeleinden, chr( 13 ), $message ?? '' );
$message = stripslashes( $message );
return ( $message );
}
function mysql2html( $message )
{
$regeleinden = ['\r\n', '\r', '\n'];
$message = str_replace( $regeleinden, "<br />", $message ?? '' );
$message = stripslashes( $message );
return ( $message );
}
function textarea2html( $message )
{
$regeleinden = [chr( 13 )];
$message = str_replace( $regeleinden, "<br />", $message ?? '' );
$message = stripslashes( $message );
return ( $message );
}
function date2mysql( $date )
{
if ( ! check_date( $date ) ) return NULL;
return date( 'Y-m-d', strtotime( $date ) );
}
function mysql2date( $date )
{
if ( ! check_date( $date ) ) return '';
return date( 'd-m-Y', strtotime( $date ) );
}
function mysql2dateWithTime( $date )
{
if ( ! check_date( $date ) ) return '';
return date( 'd-m-Y H:i:s', strtotime( $date ) );
}
function check_date( $date )
{
if ( is_null( $date ) || ( strlen( $date ) < 6 ) ) return FALSE;
return TRUE;
}
function mysql2timestamp( $date )
{
$a = strptime( $date, '%Y-%m-%d' );
$timestamp = mktime( 0, 0, 0, $a['tm_mon'] + 1, $a['tm_mday'], $a['tm_year'] + 1900 );
return $timestamp;
}
function readTextFromStorage( $text )
{
return base64_decode( $text );
}
function cleanTextForStorage( $text )
{
$text = str_replace( '/r/n', '', $text ?? '' );
$text = str_replace( '\r\n', '', $text ?? '' );
$text = str_replace( '/n', '', $text ?? '' );
$text = str_replace( '\n', '', $text ?? '' );
$text = strip_slashes( $text );
return base64_encode( $text );
}
function setTextareaForStorage( $text )
{
$text = setTextArea( $text );
return base64_encode( $text );
}
function setTextArea( $text )
{
$text = str_replace( '/r/n', chr( 13 ), $text ?? '' );
$text = str_replace( '\r\n', chr( 13 ), $text ?? '' );
$text = str_replace( '/n', chr( 13 ), $text ?? '' );
$text = str_replace( '\n', chr( 13 ), $text ?? '' );
$text = str_replace( '\r', chr( 13 ), $text ?? '' );
$text = str_replace( '/r', chr( 13 ), $text ?? '' );
$text = str_replace( '\n\n', chr( 13 ) . chr( 13 ), $text ?? '' );
$text = strip_slashes( $text );
return $text;
}
function setTextAreaHtml( $text )
{
$text = str_replace( '/r/n', '<br />', $text ?? '' );
$text = str_replace( '\r\n', '<br />', $text ?? '' );
$text = str_replace( '/n', '<br />', $text ?? '' );
$text = str_replace( '\n', '<br />', $text ?? '' );
$text = str_replace( '\r', '<br />', $text ?? '' );
$text = str_replace( '/r', '<br />', $text ?? '' );
$text = str_replace( '\n\n', '<br /><br />', $text ?? '' );
$text = strip_slashes( $text );
return $text;
}
function checkBsn( $bsn )
{
// if ( strlen( $bsn ) < 8 || strlen( $bsn ) > 9 )
// {
// return FALSE;
// }
// else
// {
// $sum = 0;
// $counter = strlen( $bsn );
// $pos = 0;
// for ( $i = $counter; $i > 0; $i -- )
// {
// if ( $i == 1 )
// {
// $sum = $sum + intval( $bsn{$pos} ) * - 1;
// }
// else
// {
// $sum = $sum + ( intval( $bsn{$pos} ) * $i );
// }
// $pos ++;
// }
// if ( $sum % 11 != 0 )
// {
// return FALSE;
// }
// }
return TRUE;
}
/**
* Validate an object property
*
* @param object $in
* @param string $property Can be NULL, in that case the first parameter is evaluated
* @param boolean $zeroAllowed ,
* default FALSE
*
* @return boolean TRUE if the property exists ans in not null or empty
*/
function isNotNullOrEmpty( $in, $property = NULL, $zeroAllowed = FALSE )
{
if ( $property === NULL )
{
if ( is_object( $in ) && count( (array) $in ) === 0 )
return FALSE;
$isNotEmpty = $zeroAllowed ? ! empty ( $in ) : $in === 0 || $in === '0' || ! empty ( $in );
if ( is_string( $in ) )
{
return $isNotEmpty && strtoupper( $in ) !== 'NULL' && strtoupper( $in ) !== 'FALSE' && strtoupper( $in ) !== 'UNDEFINED';
}
else
{
return $isNotEmpty;
}
}
if ( ! is_object( $in ) )
throw new Exception ( 'Provided test $in must be a class instance(object) or a valid classname(string)' );
if ( ! property_exists( $in, $property ) )
return FALSE;
$prop = $in->{$property};
$isNotEmpty = $zeroAllowed ? ! empty ( $prop ) : $prop === 0 || $prop === '0' || ! empty ( $prop );
if ( is_string( $prop ) )
{
return $isNotEmpty && strtoupper( $prop ) !== 'NULL' && strtoupper( $prop ) !== 'FALSE' && strtoupper( $prop ) !== 'UNDEFINED';
}
else
{
return $isNotEmpty;
}
}
/**
* Validate an object property
*
* @param object $in
* @param string $property Can be NULL, in that case the first parameter is evaluated
*
* @return boolean TRUE if the property exists and is not NULL or empty or zero
*/
function isNotNullOrEmptyOrZero( $in, $property = NULL )
{
return isNotNullOrEmpty( $in, $property, TRUE );
}
/**
* Validate an object property
*
* @param object $in
* @param string $property Can be NULL, in that case the first parameter is evaluated
*
* @return boolean TRUE if the property exists and is NULL or empty
*/
function isNullOrEmpty( $in, $property = NULL )
{
return ! isNotNullOrEmpty( $in, $property );
}
/**
* Validate an object property
*
* @param object $in
* @param string $property Can be NULL, in that case the first parameter is evaluated
*
* @return boolean TRUE if the property exists and is NULL or empty or zero
*/
function isNullOrEmptyOrZero( $in, $property = NULL )
{
return ! isNotNullOrEmpty( $in, $property, TRUE );
}
/**
*
* @param sting|integer $in
*
* @return string
*/
function parseNotNullField( $in )
{
if ( isNullOrEmpty( $in ) )
{
return '';
}
return (string) $in;
}
function unique_multidim_array( $array, $key )
{
$temp_array = [];
$key_array = [];
foreach ( $array as $val )
{
$keyValue = is_array( $val ) ? $val[ $key ] : $val->$key;
{
if ( ! in_array( $keyValue, $key_array ) )
{
$key_array[] = $keyValue;
$temp_array[] = $val;
}
}
}
return $temp_array;
}
/**
* Validate password strength
* Password must contain:
* - At least 8 characters
* - At least 1 uppercase letter
* - At least 1 lowercase letter
* - At least 1 number
* - At least 1 special character
*
* @param string $password The password to validate
* @return bool True if password meets all requirements
*/
if ( ! function_exists( 'validate_password_strength' ) )
{
function validate_password_strength( $password )
{
if ( strlen( $password ) < 8 ) {
return FALSE;
}
if ( ! preg_match( '/[A-Z]/', $password ) ) {
return FALSE;
}
if ( ! preg_match( '/[a-z]/', $password ) ) {
return FALSE;
}
if ( ! preg_match( '/[0-9]/', $password ) ) {
return FALSE;
}
if ( ! preg_match( '/[^A-Za-z0-9]/', $password ) ) {
return FALSE;
}
return TRUE;
}
}
/**
* Get password validation requirements in Dutch
*
* @return array Array of password requirements
*/
if ( ! function_exists( 'get_password_requirements_nl' ) )
{
function get_password_requirements_nl()
{
return [
'Minimaal 8 karakters',
'Minimaal 1 hoofdletter',
'Minimaal 1 kleine letter',
'Minimaal 1 cijfer',
'Minimaal 1 speciaal teken (!@#$%^&* etc.)'
];
}
}
-11
View File
@@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
-60
View File
@@ -1,60 +0,0 @@
<?php
use Illuminate\Database\Capsule\Manager as Capsule;
class EloquentHook {
/**
* Holds the instance
* @var object
*/
protected $instance;
/**
* Gets CI instance
*/
private function setInstance() {
$this->instance =& get_instance();
}
/**
* Loads database
*/
private function loadDatabase() {
$this->instance->load->database();
}
/**
* Returns the instance of the db
* @return object
*/
private function getDB() {
return $this->instance->db;
}
public function bootEloquent() {
$this->setInstance();
$this->loadDatabase();
$config = $this->getDB();
$capsule = new Capsule;
$capsule->addConnection([
'driver' => 'mysql',
'host' => $config->hostname,
'database' => $config->database,
'username' => $config->username,
'password' => $config->password,
'charset' => $config->char_set,
'collation' => $config->dbcollat,
'prefix' => $config->dbprefix,
]);
$capsule->setAsGlobal();
$capsule->bootEloquent();
}
}
-11
View File
@@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
-11
View File
@@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
-11
View File
@@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
-11
View File
@@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
-193
View File
@@ -1,193 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Two-Factor Authentication Library
* Implements TOTP (Time-based One-Time Password) for Google Authenticator
* Based on RFC 6238
*/
class TwoFactorAuth
{
protected $ci;
protected $codeLength = 6;
protected $period = 30; // 30 seconds validity window
public function __construct()
{
$this->ci =& get_instance();
}
/**
* Generate a new secret key for TOTP
* @return string Base32 encoded secret
*/
public function generateSecret($length = 16)
{
$secret = '';
$validChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'; // Base32 alphabet
for ($i = 0; $i < $length; $i++) {
$secret .= $validChars[random_int(0, 31)];
}
return $secret;
}
/**
* Generate QR code URL for Google Authenticator
* @param string $secret The user's TOTP secret
* @param string $username The username
* @param string $issuer The application name
* @return string QR code URL
*/
public function getQRCodeUrl($secret, $username, $issuer = 'DBOIS')
{
$encodedIssuer = rawurlencode($issuer);
$encodedUsername = rawurlencode($username);
$otpauthUrl = "otpauth://totp/{$encodedIssuer}:{$encodedUsername}?secret={$secret}&issuer={$encodedIssuer}";
// Using Google Charts API for QR code generation
return "https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl=" . urlencode($otpauthUrl);
}
/**
* Verify a TOTP code
* @param string $secret The user's secret
* @param string $code The code to verify
* @param int $discrepancy Time window (default 1 = +/- 30 seconds)
* @return bool True if code is valid
*/
public function verifyCode($secret, $code, $discrepancy = 1)
{
$currentTimeSlice = floor(time() / $this->period);
for ($i = -$discrepancy; $i <= $discrepancy; $i++) {
$calculatedCode = $this->getCode($secret, $currentTimeSlice + $i);
if ($this->timingSafeEquals($calculatedCode, $code)) {
return true;
}
}
return false;
}
/**
* Generate TOTP code for a given time slice
* @param string $secret The secret key
* @param int $timeSlice The time slice (defaults to current)
* @return string The generated code
*/
public function getCode($secret, $timeSlice = null)
{
if ($timeSlice === null) {
$timeSlice = floor(time() / $this->period);
}
$secretKey = $this->base32Decode($secret);
// Pack time into binary string
$time = chr(0).chr(0).chr(0).chr(0).pack('N*', $timeSlice);
// Hash with secret
$hash = hash_hmac('sha1', $time, $secretKey, true);
// Use last 4 bits as offset
$offset = ord(substr($hash, -1)) & 0x0F;
// Get 4 bytes from offset
$hashPart = substr($hash, $offset, 4);
// Unpack binary value
$value = unpack('N', $hashPart);
$value = $value[1];
// Only 32 bits
$value = $value & 0x7FFFFFFF;
// Get the required digits
$modulo = pow(10, $this->codeLength);
return str_pad($value % $modulo, $this->codeLength, '0', STR_PAD_LEFT);
}
/**
* Decode Base32 string
* @param string $secret Base32 encoded string
* @return string Binary string
*/
protected function base32Decode($secret)
{
if (empty($secret)) {
return '';
}
$base32chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
$base32charsFlipped = array_flip(str_split($base32chars));
$paddingCharCount = substr_count($secret, '=');
$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('=', $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], $base32charsFlipped)) {
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;
}
/**
* Timing-safe string comparison
* @param string $safeString Known string
* @param string $userString User provided string
* @return bool True if strings match
*/
protected 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]));
}
return $result === 0;
}
}
@@ -1,36 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 27/12/2017
* Time: 17:45
*/
class RemoveCustomer {
private $customerID;
private $allowDelete = TRUE;
public function __construct( $userID )
{
$this->setCustomerID( $userID );
$this->handle();
}
public function getAllowDelete()
{
return $this->allowDelete;
}
private function setCustomerID( $customerID )
{
$this->customerID = $customerID;
}
private function handle()
{
}
}
@@ -1,36 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 27/12/2017
* Time: 17:45
*/
class RemoveExternal {
private $externalID;
private $allowDelete = TRUE;
public function __construct( $userID )
{
$this->setExternalID( $userID );
$this->handle();
}
public function getAllowDelete()
{
return $this->allowDelete;
}
private function setExternalID( $externalID )
{
$this->externalID = $externalID;
}
private function handle()
{
}
}
@@ -1,47 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 19/12/2017
* Time: 16:52
*/
class CreateUserSession {
private $ci;
private $user;
private $sessionArray;
public function __construct()
{
$this->ci =& get_instance();
}
public function handle( $user )
{
$this->setUser( $user );
$this->setSessionArray();
$this->createSession();
}
private function setUser( $user )
{
$this->user = $user;
}
private function setSessionArray()
{
$this->sessionArray = [
'userID' => $this->user->id,
'role' => $this->user->role
];
}
private function createSession()
{
$this->ci->session->set_userdata( $this->sessionArray );
}
}
@@ -1,41 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 19/12/2017
* Time: 17:13
*/
class RetrieveUserSession {
private $ci;
public function __construct()
{
$this->ci =& get_instance();
}
public function handle()
{
$this->setUserID();
$this->setRole();
$this->setAuthenticated();
}
private function setUserID()
{
define( 'USERID', $this->ci->session->userID );
}
private function setRole()
{
define( 'ROLE', $this->ci->session->role );
}
private function setAuthenticated()
{
define( 'AUTHENTICATED', USERID ? TRUE : FALSE );
}
}
@@ -1,108 +0,0 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Send OTP Email Library
* Generates and sends a one-time password via email for two-factor authentication
*/
class SendOtpEmail
{
private $ci;
private $user;
private $otpCode;
private $sendResult;
public function __construct($user)
{
$this->ci =& get_instance();
$this->user = $user;
$this->ci->load->library('email');
$this->ci->load->model('beheer/UserOtp_model');
$this->handle();
}
/**
* Get the result of the email send operation
* @return bool True if email was sent successfully
*/
public function getSendResult()
{
return $this->sendResult;
}
/**
* Get the generated OTP code (for testing purposes)
* @return string The OTP code
*/
public function getOtpCode()
{
return $this->otpCode;
}
/**
* Main handler for OTP email process
*/
private function handle()
{
$this->generateOTP();
$this->sendOTPEmail();
}
/**
* Generate a new OTP code
*/
private function generateOTP()
{
// Generate OTP valid for 10 minutes
$this->otpCode = $this->ci->UserOtp_model->generateOTP($this->user->id, 10);
}
/**
* Send the OTP code via email
*/
private function sendOTPEmail()
{
// Build email configuration directly from environment variables
$config = [
'protocol' => $_ENV['PROTOCOL'] ?? getenv('PROTOCOL') ?: 'mail',
'smtp_host' => $_ENV['SMTP_HOST'] ?? getenv('SMTP_HOST') ?: '',
'smtp_user' => $_ENV['SMTP_USER'] ?? getenv('SMTP_USER') ?: '',
'smtp_pass' => $_ENV['SMTP_PASS'] ?? getenv('SMTP_PASS') ?: '',
'smtp_port' => $_ENV['SMTP_PORT'] ?? getenv('SMTP_PORT') ?: 25,
'smtp_crypto' => 'tls',
'smtp_timeout' => 30,
'charset' => 'iso-8859-1',
'mailtype' => 'html',
'newline' => "\r\n",
'crlf' => "\r\n",
'wordwrap' => TRUE,
'validate' => TRUE
];
// Re-initialize email library with config
$this->ci->email->initialize($config);
$data = [
'username' => $this->user->username,
'firstname' => $this->user->firstname,
'middlename' => $this->user->middlename,
'lastname' => $this->user->lastname,
'otp_code' => $this->otpCode
];
$html = $this->ci->load->view('emails/twofactor_otp_email', ['user' => $data], true);
$this->ci->email->from('noreply@dbois.nl', 'DBOIS');
$this->ci->email->to($this->user->email);
$this->ci->email->subject('DBOIS Tweefactorauthenticatie - Verificatiecode');
$this->ci->email->message($html);
$this->sendResult = $this->ci->email->send();
if (!$this->sendResult) {
log_message('error', 'Failed to send 2FA OTP email to ' . $this->user->email . ': ' . $this->ci->email->print_debugger());
}
}
}
@@ -1,16 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 26/12/2017
* Time: 12:39
*/
class CreateUser {
public function __construct()
{
}
}
@@ -1,99 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 26/12/2017
* Time: 12:40
*/
class PasswordRecipe {
private $password = FALSE;
private $salt = FALSE;
private $saltedPassword;
public function __construct()
{
$this->handle();
}
public function getPassword()
{
return $this->password;
}
public function getSalt()
{
return $this->salt;
}
public function getSaltedPassword()
{
return $this->saltedPassword;
}
public function setPassword( $password )
{
$this->password = $password;
}
public function setSalt( $salt )
{
$this->salt = $salt;
}
private function handle()
{
$this->checkPassword();
$this->checkSalt();
$this->setSaltedPassword();
}
private function checkPassword()
{
if ( ! $this->password ) $this->createPassword();
if ( strlen( $this->password ) < 6 ) return;
}
private function checkSalt()
{
if ( ! $this->salt ) $this->createSalt();
}
private function createPassword()
{
$pass = $this->getRandomString( 8 );
$this->password = $pass;
}
private function createSalt()
{
$salt = $this->getRandomString( 18 );
$this->salt = sha1($salt);
}
private function setSaltedPassword()
{
$this->saltedPassword = User::getSaltedPassword( $this->password, $this->salt);
}
private function getRandomString( $length = 8 )
{
$rand = '';
$alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
$alphaLength = strlen( $alphabet ) - 1; //put the length -1 in cache
for ( $i = 0; $i < $length; $i ++ )
{
$n = rand( 0, $alphaLength );
$rand .= $alphabet[ $n ];
}
return $rand;
}
}
@@ -1,36 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 27/12/2017
* Time: 17:45
*/
class RemoveUser {
private $userID;
private $allowDelete=FALSE;
public function __construct( $userID )
{
$this->setUserID($userID);
$this->handle();
}
public function getAllowDelete()
{
return $this->allowDelete;
}
private function setUserID( $userID )
{
$this->userID = $userID;
}
private function handle()
{
//$this->checkIfUserHasProjects();
}
}
@@ -1,104 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 28/07/2018
* Time: 14:31
*/
class RequestPassword {
private $ci;
private $salt;
private $user;
private $password;
private $sendResult;
private $passwordRecipe;
private $saltedPassword;
public function __construct( $user )
{
$this->ci =& get_instance();
$this->user = $user;
$this->ci->load->library( 'email' );
$this->handle();
}
public function getSendResult()
{
return $this->sendResult;
}
private function handle()
{
$this->createPassword();
$this->setPassword();
$this->setSalt();
$this->setSaltedPassword();
$this->persistNewpassword();
$this->sendNewPassword();
}
private function createPassword()
{
$this->passwordRecipe = new PasswordRecipe();
}
private function setPassword()
{
$this->password = $this->passwordRecipe->getPassword();
}
private function setSalt()
{
$this->salt = $this->passwordRecipe->getsalt();
}
private function setSaltedPassword()
{
$this->saltedPassword = $this->passwordRecipe->getSaltedPassword();
}
private function persistNewPassword()
{
$data = [
'password' => $this->saltedPassword,
'salt' => $this->salt
];
User::whereId( $this->user->id )->update( $data );
}
private function sendNewPassword()
{
$data = [
'username' => $this->user->username,
'firstname' => $this->user->firstname,
'middlename' => $this->user->middlename,
'lastname' => $this->user->lastname,
'password' => $this->password
];
$html = $this->ci->load->view( 'emails/requestpassword_email', ['user'=>$data], true );
$this->ci->email->from( 'noreply@dbois.nl', 'DBOIS' );
$this->ci->email->to( $this->user->email );
$this->ci->email->subject( 'Nieuw wachtwoord DBOIS' );
$this->ci->email->message( $html );
$this->ci->email->set_mailtype("html");
$this->ci->email->set_newline("\r\n");
$this->sendResult = $this->ci->email->send();
if( ! $this->sendResult ) log_message( 'error', json_encode($this->ci->email->print_debugger()));
}
}
@@ -1,72 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 27/12/2017
* Time: 14:10
*/
class UserCreation {
private $user;
private $passWordRecipe;
private $password;
private $saltedPassword;
private $salt;
public function __construct( $user )
{
$this->setUser( $user );
$this->handle();
}
public function getUser()
{
return $this->user;
}
public function getPassword()
{
return $this->password;
}
private function setUser( $user )
{
$this->user = $user;
}
private function handle()
{
$this->passWordRecipe = new PasswordRecipe();
$this->setPassword();
$this->setSalt();
$this->setSaltedPassword();
$this->enrichUser();
}
private function setPassword()
{
$this->password = $this->passWordRecipe->getPassword();
}
private function setSalt()
{
$this->salt = $this->passWordRecipe->getSalt();
}
private function setSaltedPassword()
{
$this->saltedPassword = $this->passWordRecipe->getSaltedPassword();
}
private function enrichUser()
{
$this->user['password'] = $this->saltedPassword;
$this->user['salt'] = $this->salt;
}
}
@@ -1,53 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 10/06/2018
* Time: 17:06
*/
class RemoveInvoice {
private $invoiceID;
private $payments;
private $removeAllowed;
public function __construct( $invoiceID )
{
$this->setInvoiceID( $invoiceID );
$this->handle();
}
public function getRemoveAllowed()
{
return $this->removeAllowed;
}
private function setInvoiceID( $invoiceID )
{
$this->invoiceID = $invoiceID;
}
private function handle()
{
$this->setPayment();
$this->setRemoveAllowed();
}
private function setPayment()
{
$payments = Payment::whereInvoiceId( $this->invoiceID );
$this->payments = $payments->count() == 0 ? TRUE : FALSE;
}
private function setRemoveAllowed()
{
if ( $this->payments === FALSE ) return $this->removeAllowed = FALSE;
$this->removeAllowed = TRUE;
}
}
@@ -1,46 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 10/06/2018
* Time: 15:56
*/
class RemoveInvoices {
private $invoiceID;
private $payments;
private $removeAllowed;
public function __construct( $invoiceID )
{
$this->setInvoiceID($invoiceID);
$this->handle();
}
private function setInvoiceID( $invoiceID )
{
$this->invoiceID = $invoiceID;
}
private function handle()
{
$this->setPayments();
$this->setRemoveAllowed();
}
private function setPayments()
{
$payments = Payment::whereInvoiceId($this->invoiceID);
$this->payments = $payments->count() == 0 ? TRUE : FALSE;
}
private function setRemoveAllowed()
{
$this->removeAllowed = $this->payments;
}
}
@@ -1,52 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 10/06/2018
* Time: 16:28
*/
class RemoveOffer {
private $offerID;
private $project;
private $removeAllowed;
public function __construct($offerID)
{
$this->setOfferID($offerID);
$this->handle();
}
public function getRemoveAllowed()
{
return $this->removeAllowed;
}
private function setOfferID( $offerID )
{
$this->offerID = $offerID;
}
private function handle()
{
$this->setProject();
$this->setRemoveAllowed();
}
private function setProject()
{
$offer = Offer::Find($this->offerID);
$this->project = is_null($offer->project_id) ? TRUE : FALSE;
}
private function setRemoveAllowed()
{
if( $this->project === FALSE ) return $this->removeAllowed = FALSE;
$this->removeAllowed = TRUE;
}
}
@@ -1,97 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 10/06/2018
* Time: 15:53
*/
class RemoveProject {
private $projectID;
private $forecast;
private $invoices;
private $projectemployees;
private $reservations;
private $removeAllowed;
private $projectcosts;
public function __construct( $projectID )
{
$this->setProjectID( $projectID );
$this->handle();
}
public function getRemoveAllowed()
{
return $this->removeAllowed;
}
private function setProjectID( $projectID )
{
$this->projectID = $projectID;
}
private function handle()
{
$this->setForecast();
$this->setInvoices();
$this->setProjectemployees();
$this->setReservations();
$this->setRemoveAllowed();
$this->setProjectCosts();
}
private function setForecast()
{
$forecast = Forecast::whereProjectId( $this->projectID );
$this->forecast = $forecast->count() == 0 ? TRUE : FALSE;
}
private function setInvoices()
{
$invoices = Invoice::whereProjectId( $this->projectID );
$this->invoices = $invoices->count() == 0 ? TRUE : FALSE;
}
private function setProjectemployees( )
{
$setProjectemployees = Projectemployee::whereProjectId($this->projectID);
$this->projectemployees = $setProjectemployees->count() == 0 ? TRUE : FALSE;
}
private function setReservations( )
{
$reservations = Reservation::whereProjectId($this->projectID);
$this->reservations = $reservations->count() == 0 ? TRUE : FALSE;
}
private function setProjectcosts( )
{
$projectcosts = Projectcost::whereProjectId($this->projectID);
$this->projectcosts = $projectcosts->count() == 0 ? TRUE : FALSE;
}
private function setRemoveAllowed()
{
if( $this->forecast === false ) return $this->removeAllowed = FALSE;
if( $this->invoices === false ) return $this->removeAllowed = FALSE;
if( $this->projectemployees === false ) return $this->removeAllowed = FALSE;
if( $this->reservations === false ) return $this->removeAllowed = FALSE;
if( $this->projectcosts === false ) return $this->removeAllowed = FALSE;
$this->removeAllowed = TRUE;
}
}
@@ -1,53 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 27/12/2017
* Time: 17:45
*/
class RemoveProjectemployee {
private $projectemployeeID;
private $removeAllowed;
private $projecthours;
public function __construct( $projectemployeeID )
{
$this->setProjectemployeeID( $projectemployeeID );
$this->handle();
}
public function getRemoveAllowed()
{
return $this->removeAllowed;
}
private function setProjectemployeeID( $projectemployeeID )
{
$this->projectemployeeID = $projectemployeeID;
}
private function handle()
{
$this->setProjectHours();
$this->setRemoveAllowed();
}
private function setProjecthours()
{
$projecthours = Projecthour::whereProjectemployeeId($this->projectemployeeID);
$this->projecthours = $projecthours->count() == 0 ?TRUE : FALSE;
}
private function setRemoveAllowed()
{
if( $this->projecthours === false ) return $this->removeAllowed = FALSE;
$this->removeAllowed = TRUE;
}
}
@@ -1,65 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 10/06/2018
* Time: 17:06
*/
class RemoveVat {
private $vatID;
private $projects;
private $invoices;
private $removeAllowed;
public function __construct( $vatID )
{
$this->setVatID( $vatID );
$this->handle();
}
public function getRemoveAllowed()
{
return $this->removeAllowed;
}
private function setVatID( $vatID )
{
$this->vatID = $vatID;
}
private function handle()
{
$this->setProject();
$this->setInvoices();
$this->setRemoveAllowed();
}
private function setProject()
{
$projects = Project::whereVatId( $this->vatID );
$this->projects = $projects->count() == 0 ? TRUE : FALSE;
}
private function setInvoices()
{
$invoices = Invoice::whereVatId( $this->vatID );
$this->invoices = $invoices->count() == 0 ? TRUE : FALSE;
}
private function setRemoveAllowed()
{
if ( $this->projects === FALSE ) return $this->removeAllowed = FALSE;
if ( $this->invoices === FALSE ) return $this->removeAllowed = FALSE;
$this->removeAllowed = TRUE;
}
}
-11
View File
@@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
@@ -1,36 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 27/12/2017
* Time: 17:45
*/
class RemoveForecast {
private $forecastID;
private $allowDelete = TRUE;
public function __construct( $forecastID )
{
$this->setForecastID( $forecastID );
$this->handle();
}
public function getAllowDelete()
{
return $this->allowDelete;
}
private function setForecastID( $forecastID )
{
$this->forecastID = $forecastID;
}
private function handle()
{
}
}
@@ -1,36 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 27/12/2017
* Time: 17:45
*/
class RemovePayment {
private $paymentID;
private $allowDelete = TRUE;
public function __construct( $paymentID )
{
$this->setPaymentID( $paymentID );
$this->handle();
}
public function getAllowDelete()
{
return $this->allowDelete;
}
private function setPaymentID( $paymentID )
{
$this->paymentID = $paymentID;
}
private function handle()
{
}
}
@@ -1,36 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 27/12/2017
* Time: 17:45
*/
class RemoveProjecthour {
private $projecthourID;
private $allowDelete = TRUE;
public function __construct( $projecthourID )
{
$this->setProjecthourID( $projecthourID );
$this->handle();
}
public function getAllowDelete()
{
return $this->allowDelete;
}
private function setProjecthourID( $projecthourID )
{
$this->projecthourID = $projecthourID;
}
private function handle()
{
}
}
@@ -1,36 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 27/12/2017
* Time: 17:45
*/
class RemoveReservation {
private $reservationID;
private $allowDelete = TRUE;
public function __construct( $reservationID )
{
$this->setReservationID( $reservationID );
$this->handle();
}
public function getAllowDelete()
{
return $this->allowDelete;
}
private function setReservationID( $reservationID )
{
$this->reservationID = $reservationID;
}
private function handle()
{
}
}
@@ -1,285 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 20/02/2018
* Time: 16:49
*/
class Recapprojects {
private $ci;
private $index;
private $field;
private $archive;
private $project;
private $projects;
private $direction;
private $employeeHours;
private $invoicedYears = [];
private $projectTotals;
private $employeeBudget;
private $uniqueEmployee;
private $uniqueEmployees;
private $currentFinancialYear;
private $projectEmployeeDetail;
private $projectEmployeeDetails;
public function __construct( $archive, $field, $direction )
{
$this->ci =& get_instance();
$this->archive = $archive;
$this->field = $field;
$this->direction = $direction;
$this->ci->load->Model( 'projects/Invoices_model' );
$this->handle();
}
public function getProjects()
{
return $this->projects;
}
private function handle()
{
$this->setProjects();
$this->setUniqueEmployees();
$this->loopProjects();
$this->setInvoicedYears();
$this->loopProjectsForInvoicedYears();
}
private function setProjects()
{
$this->projects = Project::getActiveProjects(
$this->archive, $this->field, $this->direction )->toArray();
}
private function setUniqueEmployees()
{
$this->uniqueEmployees =
Projectemployee::getUniqueEmployeesWithActivity();
}
private function loopProjects()
{
$this->index = 0;
foreach ( $this->projects as $this->project )
{
$this->projectTotals = 0;
$this->setProjectEmployeeDetails();
$this->loopUniqueEmployees();
$this->setBudget();
$this->setProjectCosts();
$this->setBudgetAvailable();
$this->setSaldo();
$this->setInvoiced();
$this->setWorkInProgress();
$this->setCurrentFinancialYear();
$this->index ++;
}
}
private function setProjectEmployeeDetails()
{
$this->projectEmployeeDetails =
Projectemployee::getProjectemployeeDetailsPerProject( $this->project['id'] );
}
private function loopUniqueEmployees()
{
foreach ( $this->uniqueEmployees as $this->uniqueEmployee )
{
$this->setProjectEmployeeDetail();
$this->setEmployeeBudget();
$this->setEmployeeHours();
$this->setEmployeeDetails();
$this->setProjectTotals();
}
}
private function setProjectEmployeeDetail()
{
foreach ( $this->projectEmployeeDetails as $this->projectEmployeeDetail )
{
if ( $this->uniqueEmployee->id == $this->projectEmployeeDetail->id ) return;
}
$this->projectEmployeeDetail = FALSE;
}
private function setEmployeeBudget()
{
if( property_exists($this, 'uniqueEmployee') ) return $this->employeeBudget = 0;
if( is_null($this->projectEmployeeDetail)) return $this->employeeBudget = 0;
$this->employeeBudget =
is_null( $this->projectEmployeeDetail['budget'] ) ? 0 : $this->projectEmployeeDetail['budget'];
}
private function setEmployeeHours()
{
$this->employeeHours =
$this->projectEmployeeDetail ? $this->projectEmployeeDetail->hours : 0;
}
private function setEmployeeDetails()
{
$this->projects[ $this->index ]['employees'][] = [
'id' => $this->uniqueEmployee->id,
'fullname' => $this->uniqueEmployee->fullname,
'hours' => $this->employeeHours,
'revenues' => $this->projectEmployeeDetail ? $this->projectEmployeeDetail->revenues : 0,
'budget' => $this->employeeBudget,
'availableHours' => $this->employeeBudget - $this->employeeHours
];
}
private function setProjectTotals()
{
if ( ! isset( $this->projects[ $this->index ]['projectHours'] ) )
$this->projects[ $this->index ]['projectHours'] = 0;
if ( ! isset( $this->projects[ $this->index ]['projectEuros'] ) )
$this->projects[ $this->index ]['projectEuros'] = 0;
if ( ! isset( $this->projects[ $this->index ]['hoursAvailable'] ) )
$this->projects[ $this->index ]['hoursAvailable'] = 0;
$this->projects[ $this->index ]['projectHours'] +=
$this->projectEmployeeDetail ? $this->projectEmployeeDetail->hours : 0;
$this->projects[ $this->index ]['projectEuros'] +=
$this->projectEmployeeDetail ? $this->projectEmployeeDetail->revenues : 0;
$this->projects[ $this->index ]['hoursAvailable'] +=
$this->employeeBudget - $this->employeeHours;
}
private function setBudget()
{
$this->projects[ $this->index ]['budget'] =
round( ( $this->projects[ $this->index ]['own_revenue'] + $this->projects[ $this->index ]['other_revenue'] ), 0 );
}
private function setProjectCosts()
{
$this->projects[ $this->index ]['projectcosts'] =
Projectcost::getCostsPerPerProject( $this->projects[ $this->index ]['id'] );
}
private function setBudgetAvailable()
{
$this->projects[ $this->index ]['budgetAvailable'] =
$this->projects[ $this->index ]['budget'] - $this->projects[ $this->index ]['projectcosts'];
}
private function setSaldo()
{
$this->projects[ $this->index ]['saldo'] =
$this->projects[ $this->index ]['budgetAvailable'] - $this->projects[ $this->index ]['projectEuros'];
}
private function setInvoiced()
{
$invoiced =
$this->ci->Invoices_model->getInvoicedPerYearPerProject( $this->projects[ $this->index ]['id'] );
foreach ( $invoiced ? $invoiced : [] as $invoice )
{
$this->projects[ $this->index ]['invoiced'][] = [
'year' => $invoice->invoiceyear,
'invoiced' => $invoice->invoiced
];
$this->setTotalInvoiced( $invoice->invoiced );
}
if ( ! isset( $this->projects[ $this->index ]['invoiced'] ) )
{
$this->projects[ $this->index ]['invoiced'] = [];
$this->projects[ $this->index ]['totalInvoiced'] = 0;
}
}
private function setTotalInvoiced( $invoiced )
{
if ( ! isset( $this->projects[ $this->index ]['totalInvoiced'] ) )
$this->projects[ $this->index ]['totalInvoiced'] = 0;
$this->projects[ $this->index ]['totalInvoiced'] += $invoiced;
}
private function setWorkInProgress()
{
$this->projects[ $this->index ]['workInProgress'] =
$this->projects[ $this->index ]['projectEuros'] +
$this->projects[ $this->index ]['projectcosts'] -
$this->projects[ $this->index ]['totalInvoiced'];
if ( $this->projects[ $this->index ]['workInProgress'] < 0 )
$this->projects[ $this->index ]['workInProgress'] = 0;
}
private function setCurrentFinancialYear()
{
$this->currentFinancialYear = $this->project['current_financial_year'];
}
private function setInvoicedYears()
{
foreach ( $this->projects as $this->project )
{
foreach ( $this->project['invoiced'] as $year )
{
if ( in_array( $year['year'], $this->invoicedYears ) ) continue;
array_push( $this->invoicedYears, $year['year'] );
}
}
}
private function loopProjectsForInvoicedYears()
{
$this->index = 0;
foreach ( $this->projects as $this->project )
{
foreach ( $this->invoicedYears as $invoiceYear )
{
$hasYear = FALSE;
foreach ( $this->project['invoiced'] as $year )
{
if ( $invoiceYear == $year['year'] ) $hasYear = TRUE;
}
if ( ! $hasYear ) $this->projects[ $this->index ]['invoiced'][] = [
'year' => $invoiceYear,
'invoiced' => 0
];
}
usort( $this->projects[ $this->index ]['invoiced'], function ( $a, $b ) {
return $a['year'] - $b['year'];
} );
$this->index ++;
}
}
}
@@ -1,75 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 30/07/2018
* Time: 10:48
*/
class InvoiceForecastSheet {
const HEADERS = [
'A' => 'project',
'B' => 'klant',
'C' => 'Nog te factureren incl. btw',
'D' => 'Nog te factureren incl. btw lopend boekjaar incl. btw',
'E' => 'Nog te factureren na lopend boekjaar inc. btw',
'F' => 'Nog te prognotiseren inc. btw'
];
private $invoiceForecast;
private $sheet;
private $row;
public function __construct( $invoiceForecast, $sheet )
{
$this->invoiceForecast = $invoiceForecast;
$this->sheet = $sheet;
$this->handle();
}
private function handle()
{
$this->setHeader();
$this->setBody();
$this->setTotals();
}
private function setHeader()
{
foreach ( self::HEADERS as $cell => $header )
{
$this->sheet->setCellValue( $cell . '1', $header );
$this->sheet->getColumnDimension( $cell )->setAutoSize( TRUE );
}
}
private function setBody()
{
$this->row = 2;
foreach ( $this->invoiceForecast AS $project )
{
$this->sheet->setCellValue( 'A' . $this->row, $project['projectname'] );
$this->sheet->setCellValue( 'B' . $this->row, $project['customer'] );
$this->sheet->setCellValue( 'C' . $this->row, str_replace( '.', '', $project['needInvoice'] ?? '' ) );
$this->sheet->setCellValue( 'D' . $this->row, str_replace( '.', '', $project['forecastThisYear'] ?? '' ) );
$this->sheet->setCellValue( 'E' . $this->row, str_replace( '.', '', $project['forecastOtherYears'] ?? '' ) );
$this->sheet->setCellValue( 'F' . $this->row, str_replace( '.', '', $project['forecastRemaining'] ?? '' ) );
$this->row ++;
}
}
private function setTotals()
{
$lastRow = $this->row - 1;
$this->sheet->setCellValue( 'C' . $this->row, '=SUM(C2:C' . $lastRow . ')' );
$this->sheet->setCellValue( 'D' . $this->row, '=SUM(D2:D' . $lastRow . ')' );
$this->sheet->setCellValue( 'E' . $this->row, '=SUM(E2:E' . $lastRow . ')' );
$this->sheet->setCellValue( 'F' . $this->row, '=SUM(F2:F' . $lastRow . ')' );
}
}
@@ -1,80 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 29/07/2018
* Time: 20:40
*/
class InvoiceOverviewSheet {
const HEADERS = [
'A' => 'project',
'B' => 'klant',
'C' => 'Totaal te factureren excl. btw',
'D' => 'Totaal te factureren incl. btw',
'E' => 'Gefactureerd overige jaren incl. btw',
'F' => 'Gefactureerd lopende boekjaar incl. btw',
'G' => 'Gefactureerd totaal incl. btw',
'H' => 'Nog te factureren incl. btw'
];
private $invoiceOverview;
private $sheet;
private $row;
public function __construct( $invoiceOverview, $sheet )
{
$this->invoiceOverview = $invoiceOverview;
$this->sheet = $sheet;
$this->handle();
}
private function handle()
{
$this->setHeader();
$this->setBody();
$this->setTotals();
}
private function setHeader()
{
foreach ( self::HEADERS as $cell => $header )
{
$this->sheet->setCellValue( $cell . '1', $header );
$this->sheet->getColumnDimension( $cell )->setAutoSize( TRUE );
}
}
private function setBody()
{
$this->row = 2;
foreach ( $this->invoiceOverview AS $project )
{
$this->sheet->setCellValue( 'A' . $this->row, $project['projectname'] );
$this->sheet->setCellValue( 'B' . $this->row, $project['customer'] );
$this->sheet->setCellValue( 'C' . $this->row, str_replace( '.', '', $project['totalToInvoicingExcl'] ?? '' ) );
$this->sheet->setCellValue( 'D' . $this->row, str_replace( '.', '', $project['totalToInvoicingIncl'] ?? '' ) );
$this->sheet->setCellValue( 'E' . $this->row, str_replace( '.', '', $project['totalInvoicedOtherYears'] ?? '' ) );
$this->sheet->setCellValue( 'F' . $this->row, str_replace( '.', '', $project['totalInvoicedThisYear'] ?? '' ) );
$this->sheet->setCellValue( 'G' . $this->row, str_replace( '.', '', $project['invoicesTotal'] ?? '' ) );
$this->sheet->setCellValue( 'H' . $this->row, str_replace( '.', '', $project['needInvoice'] ?? '' ) );
$this->row ++;
}
}
private function setTotals()
{
$lastRow = $this->row - 1;
$this->sheet->setCellValue( 'C' . $this->row, '=SUM(C2:C' . $lastRow . ')' );
$this->sheet->setCellValue( 'D' . $this->row, '=SUM(D2:D' . $lastRow . ')' );
$this->sheet->setCellValue( 'E' . $this->row, '=SUM(E2:E' . $lastRow . ')' );
$this->sheet->setCellValue( 'F' . $this->row, '=SUM(F2:F' . $lastRow . ')' );
$this->sheet->setCellValue( 'G' . $this->row, '=SUM(G2:G' . $lastRow . ')' );
$this->sheet->setCellValue( 'H' . $this->row, '=SUM(H2:H' . $lastRow . ')' );
}
}
@@ -1,136 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 29/07/2018
* Time: 20:04
*/
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
class InvoiceSpreadsheet {
private $invoiceReport;
private $spreadsheet;
private $invoiceSheet;
private $fullpathname;
private $filename;
private $ci;
public function __construct( $invoiceReport )
{
$this->ci =& get_instance();
$this->invoiceReport = $invoiceReport;
$this->ci->load->helper( 'download' );
$this->handle();
}
private function handle()
{
$this->setSpreadsheet();
$this->setInvoiceOverviewSheet();
$this->setInvoiceForecast();
$this->setMonthForecast();
$this->setMonthPayment();
$this->setInvoiced();
$this->setFilename();
$this->setFullPathname();
$this->createFile();
$this->downloadSpreadsheet();
}
private function setSpreadsheet()
{
$this->spreadsheet = new Spreadsheet();
}
private function setInvoiceOverviewSheet()
{
$invoiceSheet = new Worksheet( $this->spreadsheet, 'Facturen' );
$this->invoiceSheet =
$this->spreadsheet->addSheet( $invoiceSheet );
new InvoiceOverviewSheet( $this->invoiceReport['invoiceOverview'], $this->invoiceSheet );
}
private function setInvoiceForecast()
{
$invoiceSheet = new Worksheet( $this->spreadsheet, 'prognose' );
$this->invoiceSheet =
$this->spreadsheet->addSheet( $invoiceSheet );
new InvoiceForecastSheet( $this->invoiceReport['forecasts'], $this->invoiceSheet );
}
private function setMonthForecast()
{
$invoiceSheet = new Worksheet( $this->spreadsheet, 'maandprognose' );
$this->invoiceSheet =
$this->spreadsheet->addSheet( $invoiceSheet );
new MonthForecastSheet( $this->invoiceReport['monthForecasts'], $this->invoiceSheet );
}
private function setMonthPayment()
{
$invoiceSheet = new Worksheet( $this->spreadsheet, 'maand betalingen' );
$this->invoiceSheet =
$this->spreadsheet->addSheet( $invoiceSheet );
new MonthPaymentSheet( $this->invoiceReport['monthPayments'], $this->invoiceSheet );
}
private function setInvoiced()
{
$invoiceSheet = new Worksheet( $this->spreadsheet, 'verstuurde facturen' );
$this->invoiceSheet =
$this->spreadsheet->addSheet( $invoiceSheet );
new InvoicedSheet( $this->invoiceReport['invoiced'], $this->invoiceSheet );
}
private function setFilename()
{
$this->filename = 'facturen' . date( 'YmdHis' ) . '.xlsx';
}
private function setFullPathname()
{
$this->fullpathname = MYROOTPATH . 'documents/spreadsheets/' . $this->filename;
}
private function createFile()
{
$writer = new Xlsx( $this->spreadsheet );
$writer->save( $this->fullpathname );
}
private function downloadSpreadsheet()
{
$data = file_get_contents( $this->fullpathname );
force_download( $this->filename, $data );
}
}
@@ -1,67 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 30/07/2018
* Time: 10:48
*/
class InvoicedSheet {
const HEADERS = [
'A' => 'factuurnummer',
'B' => 'project',
'C' => 'klant',
'D' => 'factuurdatum',
'E' => 'exc btw',
'F' => 'btw',
'G' => 'incl btw'
];
private $invoiced;
private $sheet;
private $row;
public function __construct( $invoiced, $sheet )
{
$this->invoiced = $invoiced;
$this->sheet = $sheet;
$this->handle();
}
private function handle()
{
$this->setHeader();
$this->setBody();
}
private function setHeader()
{
foreach ( self::HEADERS as $cell => $header )
{
$this->sheet->setCellValue( $cell . '1', $header );
$this->sheet->getColumnDimension( $cell )->setAutoSize( TRUE );
}
}
private function setBody()
{
$this->row = 2;
foreach ( $this->invoiced AS $invoice )
{
$vat = ROUND($invoice->invoiceamount * 0.21, 2);
$this->sheet->setCellValue( 'A' . $this->row, $invoice->invoicenumber );
$this->sheet->setCellValue( 'B' . $this->row, ($invoice->projectnumber . ' ' . $invoice['projectname']));
$this->sheet->setCellValue( 'C' . $this->row, $invoice->name );
$this->sheet->setCellValue( 'D' . $this->row, $invoice->invoicenumber );
$this->sheet->setCellValue( 'E' . $this->row, $invoice->invoiceamount );
$this->sheet->setCellValue( 'F' . $this->row, $vat );
$this->sheet->setCellValue( 'G' . $this->row, $invoice->invoiceamount + $vat );
$this->row ++;
}
}
}
@@ -1,101 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 30/07/2018
* Time: 10:48
*/
class MonthForecastSheet {
const HEADERS = [
'A' => 'project',
'B' => 'klant',
'C' => 'Nog te factureren incl. btw',
'D' => 'januari',
'E' => 'februari',
'F' => 'maart',
'G' => 'april',
'H' => 'mei',
'I' => 'juni',
'J' => 'juli',
'K' => 'augustus',
'L' => 'september',
'M' => 'oktober',
'N' => 'november',
'O' => 'december',
'P' => 'Nog te factureren na lopend boekjaar inc. btw',
'Q' => 'Nog te prognotiseren inc. btw'
];
const MONTH_COLUMNS = ['D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O'];
private $invoiceForecast;
private $sheet;
private $row;
public function __construct( $invoiceForecast, $sheet )
{
$this->invoiceForecast = $invoiceForecast;
$this->sheet = $sheet;
$this->handle();
}
private function handle()
{
$this->setHeader();
$this->setBody();
$this->setTotals();
}
private function setHeader()
{
foreach ( self::HEADERS as $cell => $header )
{
$this->sheet->setCellValue( $cell . '1', $header );
$this->sheet->getColumnDimension( $cell )->setAutoSize( TRUE );
}
}
private function setBody()
{
$this->row = 2;
foreach ( $this->invoiceForecast AS $project )
{
$this->sheet->setCellValue( 'A' . $this->row, $project['projectname'] );
$this->sheet->setCellValue( 'B' . $this->row, $project['customer'] );
$this->sheet->setCellValue( 'C' . $this->row, str_replace( '.', '', $project['needInvoice'] ?? '' ) );
$columnCount = 0;
foreach ( $project['forecastMonths'] as $month )
{
$column = self::MONTH_COLUMNS[ $columnCount ];
$forecast = $month['forecastamount'];
$this->sheet->setCellValue( $column . $this->row, $forecast );
$columnCount ++;
}
$this->sheet->setCellValue( 'P' . $this->row, str_replace( '.', '', $project['forecastOtherYears'] ?? '' ) );
$this->sheet->setCellValue( 'Q' . $this->row, str_replace( '.', '', $project['forecastRemaining'] ?? '' ) );
$this->row ++;
}
}
private function setTotals()
{
$lastRow = $this->row - 1;
$this->sheet->setCellValue( 'C' . $this->row, '=SUM(C2:C' . $lastRow . ')' );
$this->sheet->setCellValue( 'D' . $this->row, '=SUM(D2:D' . $lastRow . ')' );
foreach ( self::MONTH_COLUMNS as $column )
{
$this->sheet->setCellValue( $column . $this->row, '=SUM(' . $column . '2:' . $column . $lastRow . ')' );
}
$this->sheet->setCellValue( 'P' . $this->row, '=SUM(P2:P' . $lastRow . ')' );
$this->sheet->setCellValue( 'Q' . $this->row, '=SUM(Q2:Q' . $lastRow . ')' );
}
}
@@ -1,95 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 30/07/2018
* Time: 10:48
*/
class MonthPaymentSheet {
const HEADERS = [
'A' => 'project',
'B' => 'klant',
'C' => 'januari',
'D' => 'februari',
'E' => 'maart',
'F' => 'april',
'G' => 'mei',
'H' => 'juni',
'I' => 'juli',
'J' => 'augustus',
'K' => 'september',
'L' => 'oktober',
'M' => 'november',
'N' => 'december',
'O' => 'Totaal betaald lopend boekjaar inc. btw'
];
const MONTH_COLUMNS = ['C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N'];
private $invoiceForecast;
private $sheet;
private $row;
public function __construct( $invoiceForecast, $sheet )
{
$this->invoiceForecast = $invoiceForecast;
$this->sheet = $sheet;
$this->handle();
}
private function handle()
{
$this->setHeader();
$this->setBody();
$this->setTotals();
}
private function setHeader()
{
foreach ( self::HEADERS as $cell => $header )
{
$this->sheet->setCellValue( $cell . '1', $header );
$this->sheet->getColumnDimension( $cell )->setAutoSize( TRUE );
}
}
private function setBody()
{
$this->row = 2;
foreach ( $this->invoiceForecast AS $project )
{
$this->sheet->setCellValue( 'A' . $this->row, $project['projectname'] );
$this->sheet->setCellValue( 'B' . $this->row, $project['customer'] );
$columnCount = 0;
foreach ( $project['monthPayments'] as $month )
{
$column = self::MONTH_COLUMNS[ $columnCount ];
$forecast = $month['paymentamount'];
$this->sheet->setCellValue( $column . $this->row, $forecast );
$columnCount ++;
}
$formula = '=SUM(C'.$this->row.':N'.$this->row.')';
$this->sheet->setCellValue( 'O' . $this->row, $formula);
$this->row ++;
}
}
private function setTotals()
{
$lastRow = $this->row - 1;
foreach ( self::MONTH_COLUMNS as $column )
{
$this->sheet->setCellValue( $column . $this->row, '=SUM(' . $column . '2:' . $column . $lastRow . ')' );
}
$this->sheet->setCellValue( 'O' . $this->row, '=SUM(O2:O' . $lastRow . ')' );
}
}
@@ -1,125 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 29/07/2018
* Time: 13:14
*/
class InvoiceForecast {
private $year;
private $project;
private $customer;
private $forecast;
private $currentYear;
private $projectname;
private $needInvoice;
private $projectDetails;
private $forecastThisYear = 0;
private $forecastRemaining;
private $forecastOtherYears = 0;
public function __construct( $project, $needInvoice, $year )
{
$this->project = $project;
$this->needInvoice = $needInvoice;
$this->year = $year;
$this->handle();
}
public function getProjectDetails()
{
return $this->projectDetails;
}
public function getNeedInvoice()
{
return $this->needInvoice;
}
public function getForecastOtherYear()
{
return $this->forecastOtherYears;
}
public function getForecastRemaining()
{
return $this->forecastRemaining;
}
private function handle()
{
$this->setCurrentyear();
$this->setProjectname();
$this->setCustomer();
$this->loopForecasts();
$this->setForecastRemaining();
$this->setProjectDetails();
}
private function setCurrentyear()
{
$this->currentYear = date( 'Y' );
}
private function setProjectname()
{
$this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')';
}
private function setCustomer()
{
$this->customer = $this->project->customer->name;
}
private function loopForecasts()
{
if ( is_null( $this->project->forecasts ) ) return $this->forecastThisYear = 0;
foreach ( $this->project->forecasts as $this->forecast )
{
$this->setForecastThisYear();
$this->setForecastOtherYears();
}
}
private function setForecastThisYear()
{
if ( $this->forecast->year == $this->year )
$this->forecastThisYear += $this->forecast->forecastamount;
}
private function setForecastOtherYears()
{
if ( $this->forecast->year != $this->year )
$this->forecastOtherYears += $this->forecast->forecastamount;
}
private function setForecastRemaining()
{
$this->forecastRemaining =
$this->needInvoice - $this->forecastThisYear - $this->forecastOtherYears;
}
private function setProjectDetails()
{
$this->projectDetails = [
'projectnumber' => $this->project->projectnumber,
'projectname' => $this->projectname,
'customer' => $this->customer,
'needInvoice' => number_format( $this->needInvoice, 0, ',', '.' ),
'forecastThisYear' => number_format( $this->forecastThisYear, 0, ',', '.' ),
'forecastOtherYears' => number_format( $this->forecastOtherYears, 0, ',', '.' ),
'forecastRemaining' => number_format( $this->forecastRemaining, 0, ',', '.' ),
];
}
}
@@ -1,151 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 29/07/2018
* Time: 10:29
*/
class InvoiceOverview {
private $project;
private $year;
private $projectname;
private $customer;
private $totalToInvoicingExcl;
private $totalToInvoicingIncl;
private $totalInvoicedOtherYears;
private $totalInvoicedThisYear;
private $invoicesTotal;
private $needInvoice;
private $projectDetails;
private $projectnumber;
private $projectPayment;
private $invoicesToPay;
public function __construct( $project, $year )
{
$this->project = $project;
$this->year = $year;
$this->handle();
}
public function getProjectDetails()
{
return $this->projectDetails;
}
public function getNeedinvoice()
{
return $this->needInvoice;
}
private function handle()
{
$this->setProjectnumber();
$this->setProjectname();
$this->setCustomer();
$this->setTotalToInvoicingExcl();
$this->setTotalToInvoicingIncl();
$this->setTotalInvoicedOtherYears();
$this->setTotalInvoicedThisYear();
$this->setPaymentPerProject();
$this->setInvoicesTotal();
$this->setInvoicesToPay();
$this->setNeedInvoice();
$this->setProjectDetails();
}
private function setProjectnumber()
{
$this->projectnumber = $this->project->projectnumber;
}
private function setProjectname()
{
$this->projectname = $this->project->projectname;
}
private function setCustomer()
{
$this->customer = $this->project->customer->name;
}
private function setTotalToInvoicingExcl()
{
$offer = $this->project->offer;
$this->totalToInvoicingExcl =
$offer->own_revenue + $offer->other_revenue + $offer->costs;
}
private function setTotalToInvoicingIncl()
{
$this->totalToInvoicingIncl =
$this->totalToInvoicingExcl * ( 1 + ( $this->project->vat->vatrate / 100 ) );
}
private function setTotalInvoicedOtherYears()
{
$this->totalInvoicedOtherYears =
Invoice::invoicePerYear( $this->project->id, $this->year, FALSE );
}
private function setTotalInvoicedThisYear()
{
$this->totalInvoicedThisYear =
Invoice::invoicePerYear( $this->project->id, $this->year, TRUE );
}
private function setPaymentPerProject()
{
$this->projectPayment = Payment::getPaymentPerProject( $this->project->id );
}
private function setInvoicesTotal()
{
$this->invoicesTotal =
$this->totalInvoicedOtherYears + $this->totalInvoicedThisYear;
}
private function setInvoicesToPay()
{
$this->invoicesToPay = $this->invoicesTotal - $this->projectPayment;
}
private function setNeedInvoice()
{
$this->needInvoice =
$this->totalToInvoicingIncl - $this->invoicesTotal;
}
private function setProjectDetails()
{
$this->projectDetails = [
'projectnumber' => $this->projectnumber,
'projectname' => $this->projectname,
'customer' => $this->customer,
'totalToInvoicingExcl' => number_format( $this->totalToInvoicingExcl ?? 0, 0, ',', '.' ),
'totalToInvoicingIncl' => number_format( $this->totalToInvoicingIncl ?? 0, 0, ',', '.' ),
'totalInvoicedOtherYears' => number_format( $this->totalInvoicedOtherYears ?? 0, 0, ',', '.' ),
'totalInvoicedThisYear' => number_format( $this->totalInvoicedThisYear ?? 0, 0, ',', '.' ),
'invoicesTotal' => number_format( $this->invoicesTotal ?? 0, 0, ',', '.' ),
'projectPayment' => number_format( $this->projectPayment ?? 0, 0, ',', '.' ),
'invoiceToPay' => number_format( $this->invoicesToPay ?? 0, 0, ',', '.' ),
'needInvoice' => number_format( $this->needInvoice ?? 0, 0, ',', '.' )
];
}
}
@@ -1,133 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 29/07/2018
* Time: 10:19
*/
class Invoices {
private $year;
private $project;
private $projects;
private $monthPayment;
private $monthPayments;
private $monthForecast;
private $monthForecasts;
private $invoiceOverview;
private $invoiceForecast;
private $invoiceForecasts;
private $invoiceOverviews = [];
private $invoiceReport = [];
private $orderType;
private $orderDirection;
private $archive;
private $invoicedYears;
private $invoiced;
public function __construct( $year, $orderType, $orderDirection, $archive )
{
$this->year = $year;
$this->orderType = $orderType;
$this->orderDirection = $orderDirection;
$this->archive = $archive;
$this->handle();
}
public function getInvoiceReport()
{
return $this->invoiceReport;
}
private function handle()
{
$this->setProjects();
$this->loopProjects();
//only projects with payments also archived projects
$this->setMonthPayments();
$this->setInvoicedyears();
$this->setInvoiced();
$this->setInvoiceReport();
}
private function setProjects()
{
$this->projects =
Project::getProjectsForReport( $this->orderType, $this->orderDirection, $this->archive );
}
private function loopProjects()
{
foreach ( $this->projects as $this->project )
{
$this->setInvoiceOverview();
$this->setInvoiceForecasts();
$this->setMonthForecasts();
}
}
private function setInvoiceOverview()
{
$this->invoiceOverview = new InvoiceOverview( $this->project, $this->year );
$this->invoiceOverviews[] = $this->invoiceOverview->getProjectDetails();
}
private function setInvoiceForecasts()
{
$this->invoiceForecast =
new InvoiceForecast( $this->project, $this->invoiceOverview->getNeedinvoice(), $this->year );
$this->invoiceForecasts[] = $this->invoiceForecast->getProjectDetails();
}
public function setMonthForecasts()
{
$this->monthForecast =
new MonthForecast( $this->invoiceForecast, $this->project, $this->year );
$this->monthForecasts[] = $this->monthForecast->getProjectDetails();
}
public function setMonthPayments()
{
$monthPayment = new MonthPayments(
$this->year, $this->orderType, $this->orderDirection );
$this->monthPayments = $monthPayment->getProjectDetails();
}
private function setInvoiced()
{
$this->invoiced = Invoice::getInvoiced( $this->year, $this->orderType, $this->orderDirection );
}
private function setInvoicedYears()
{
$this->invoicedYears = Invoice::selectRaw( 'DATE_FORMAT(invoicedate, "%Y") AS years' )
->distinct()
->orderBy( 'invoicedate' )
->pluck( 'years' );
}
private function setInvoiceReport()
{
$this->invoiceReport = [
'invoiceOverview' => $this->invoiceOverviews,
'forecasts' => $this->invoiceForecasts,
'monthForecasts' => $this->monthForecasts,
'monthPayments' => $this->monthPayments,
'invoicedYears' => $this->invoicedYears,
'invoiced' => $this->invoiced
];
}
}
@@ -1,92 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 29/07/2018
* Time: 14:23
*/
class MonthForecast {
private $year;
private $project;
private $forecast;
private $customer;
private $projectname;
private $forecastMonths;
private $projectDetails;
private $invoiceForecast;
public function __construct( InvoiceForecast $invoiceForecast, $project, $year )
{
$this->project = $project;
$this->invoiceForecast = $invoiceForecast;
$this->year = $year;
$this->handle();
}
public function getProjectDetails()
{
return $this->projectDetails;
}
private function handle()
{
$this->setProjectname();
$this->setCustomer();
$this->setInitialsForecastMonths();
$this->loopForecasts();
$this->setProjectDetails();
}
private function setProjectname()
{
$this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')';
}
private function setCustomer()
{
$this->customer = $this->project->customer->name;
}
private function setInitialsForecastMonths()
{
for ( $i = 0; $i < 12; $i ++ )
{
$this->forecastMonths[ $i ] = ['forecastamount' => 0];
}
}
private function loopForecasts()
{
foreach ( $this->project->forecasts as $this->forecast )
{
$this->setMonthForecast();
}
}
private function setMonthForecast()
{
if ( $this->forecast->year == $this->year )
$this->forecastMonths[ $this->forecast->month_id ]['forecastamount'] += $this->forecast->forecastamount;
}
private function setProjectDetails()
{
$this->projectDetails = [
'projectnumber' => $this->project->projectnumber,
'projectname' => $this->projectname,
'customer' => $this->customer,
'needInvoice' => number_format( $this->invoiceForecast->getNeedInvoice(), 0, ',', '.' ),
'forecastOtherYears' => number_format( $this->invoiceForecast->getForecastOtherYear(), 0, ',', '.' ),
'forecastRemaining' => number_format( $this->invoiceForecast->getForecastRemaining(), 0, ',', '.' ),
'forecastMonths' => $this->forecastMonths
];
}
}
@@ -1,128 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 29/07/2018
* Time: 14:23
*/
class MonthPayments {
private $year;
private $project;
private $payment;
private $customer;
private $projectname;
private $monthPayments;
private $projectDetails;
private $projectsWithPayments;
private $totalProjectPayments;
private $orderType;
private $orderDirection;
public function __construct( $year, $orderType, $orderDirection )
{
$this->year = $year;
$this->orderType = $orderType;
$this->orderDirection = $orderDirection;
$this->handle();
}
public function getProjectDetails()
{
return $this->projectDetails;
}
private function handle()
{
$this->setProjectsWithPayments();
$this->loopProjectsWithPayments();
}
private function setProjectsWithPayments()
{
$projectsArray = Payment::getProjectsWithPayments( $this->year );
$this->projectsWithPayments =
Project::getProjectsForReport(
$this->orderType, $this->orderDirection, FALSE, $projectsArray );
}
private function loopProjectsWithPayments()
{
foreach ( $this->projectsWithPayments as $this->project )
{
$this->setProjectname();
$this->setCustomer();
$this->setInitialsMonthPayments();
$this->loopPayments();
$this->setProjectDetails();
}
}
private function setProjectname()
{
$this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')';
}
private function setCustomer()
{
$this->customer = $this->project->customer->name;
}
private function setInitialsMonthPayments()
{
for ( $i = 1; $i <= 12; $i ++ )
{
$this->monthPayments[ $i ] = ['paymentamount' => 0];
}
}
private function loopPayments()
{
$this->totalProjectPayments = 0;
foreach ( $this->project->invoices as $invoice )
{
foreach ( $invoice->payments as $this->payment )
{
$this->setMonthPayments();
$this->setTotalProjectPayments();
}
}
}
private function setMonthPayments()
{
$paymentYear = date( 'Y', strtotime( $this->payment->paymentdate ) );
$paymentMonth = date( 'n', strtotime( $this->payment->paymentdate ) );
if ( $paymentYear == $this->year )
$this->monthPayments[ $paymentMonth ]['paymentamount'] += $this->payment->paymentamount;
}
private function setTotalProjectPayments()
{
$paymentYear = date( 'Y', strtotime( $this->payment->paymentdate ) );
if ( $paymentYear == $this->year )
$this->totalProjectPayments += $this->payment->paymentamount;
}
private function setProjectDetails()
{
$this->projectDetails[] = [
'projectnumber' => $this->project->projectnumber,
'projectname' => $this->projectname,
'customer' => $this->customer,
'monthPayments' => $this->monthPayments,
'totalProjectPayments' => number_format( $this->totalProjectPayments, 0, ',', '.' )
];
}
}
@@ -1,224 +0,0 @@
<?php defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
/**
* Created by PhpStorm.
* User: imac-3
* Date: 04/06/16
* Time: 14:17
*/
class validation {
private $fieldValue;
private $validations;
private $validation;
private $validationResult;
private $errorMessages = [];
private $validationField;
private $ci;
public function __construct()
{
$this->ci =& get_instance();
}
public function validate( $fieldValue, $validationField = FALSE )
{
$this->setValidationField( $validationField );
$this->setFieldValue( $fieldValue );
$this->handle();
}
public function setValidationField( $validationfield )
{
$this->validationField = $validationfield;
}
public function getErrorMessages()
{
return $this->errorMessages;
}
public function getValidationResult()
{
return $this->validationResult;
}
private function handle()
{
$this->setValidations();
$this->checkValidations();
$this->setValidationResult();
}
private function setValidations()
{
$this->validations = explode( '|', $this->validationField['validations'] );
}
private function setFieldValue( $fieldValue )
{
$this->fieldValue = $fieldValue;
}
private function setValidationResult()
{
if ( count( $this->errorMessages ) == 0 ) return $this->validationResult = TRUE;
$this->validationResult = FALSE;
}
private function checkValidations()
{
foreach ( $this->validations as $this->validation )
{
if ( $this->validation == 'required' ) $this->checkRequired();
if ( $this->validation == 'alpha' ) $this->checkAlfa();
if ( $this->validation == 'alphaNumeric' ) $this->checkAlfanumeric();
if ( $this->validation == 'alphaNumericSpaces' ) $this->checkAlphaNumericSpaces();
if ( $this->validation == 'alphaDash' ) $this->checkAlphaDash();
if ( $this->validation == 'numeric' ) $this->checkNumeric();
if ( $this->validation == 'integer' ) $this->checkInteger();
if ( $this->validation == 'decimal' ) $this->checkDecimal();
if ( $this->validation == 'email' ) $this->checkEmail();
if ( $this->validation == 'unique' ) $this->checkUnique();
if( $this->validation == 'date' ) $this->checkdate();
if ( substr( $this->validation, 0, 9 ) == 'minlength' ) $this->checkMinlength();
if ( substr( $this->validation, 0, 9 ) == 'maxlength' ) $this->checkMaxlength();
if ( substr( $this->validation, 0, 8 ) == 'minvalue' ) $this->checkMinvalue();
if ( substr( $this->validation, 0, 8 ) == 'maxvalue' ) $this->checkMaxvalue();
}
}
public function checkRequired()
{
if ( ! $this->fieldValue || empty( $this->fieldValue ) || strlen( $this->fieldValue ) == 0 )
$this->errorMessages[] = 'veld is verplicht';
}
public function checkAlfa()
{
$value = ctype_alpha( $this->fieldValue );
if ( ! $value ) $this->errorMessages[] = 'alleen letters toegestaan';
}
public function checkAlfaNumeric()
{
$value = ctype_alnum( (string) $this->fieldValue );
if ( ! $value ) $this->errorMessages[] = 'alleen letters en cijfers toegestaan';
return $value;
}
public function checkAlphaNumericSpaces()
{
$value = (bool) preg_match( '/^[A-Z0-9 ]+$/i', $this->fieldValue );
if ( ! $value ) $this->errorMessages[] = 'alleen letters, cijfers en spaties toegestaan';
}
public function checkAlphaDash()
{
$value = (bool) preg_match( '/^[a-z0-9_-]+$/i', $this->fieldValue );
if ( ! $value ) $this->errorMessages[] = 'alleen letters, cijfers en streepjes toegestaan';
}
public function checkNumeric()
{
$value = (bool) preg_match( '/^[\-+]?[0-9]*\.?[0-9]+$/', $this->fieldValue );
if ( ! $value ) $this->errorMessages[] = 'alleen getallen toegestaan';
}
public function checkInteger()
{
$value = (bool) preg_match( '/^[\-+]?[0-9]+$/', $this->fieldValue );
if ( ! $value ) $this->errorMessages[] = 'alleen gehele getallen toegestaan';
}
public function checkDecimal()
{
$value = is_numeric( $this->fieldValue );
if ( ! $value ) $this->errorMessages[] = 'alleen getallen toegestaan';
}
public function checkEmail()
{
if ( ! $this->fieldValue || empty( $this->fieldValue ) || strlen( $this->fieldValue ) == 0 ) return;
$value = (bool) filter_var( $this->fieldValue, FILTER_VALIDATE_EMAIL );
if ( ! $value ) $this->errorMessages[] = 'ongeldig emailadres';
}
public function checkUnique()
{
$recordID = $this->ci->input->post( 'id' );
$model = $this->validationField['model'];
$field = $this->validationField['field'];
$value = $this->ci
->$model
->checkUnique( $recordID, $field, $this->fieldValue );
if ( ! $value ) $this->errorMessages[] = 'invoer moet uniek zijn';
}
public function checkDate()
{
if( empty($this->fieldValue) ) return;
$dateParts = explode('-', $this->fieldValue);
if( count($dateParts) != 3) $dateParts = explode('/', $this->fieldValue);
if( count($dateParts) != 3)
return $this->errorMessages[] = 'invoer is geen datum';
if( ! checkdate($dateParts[1], $dateParts[0], $dateParts[2] ))
$this->errorMessages[] = 'invoer is geen datum';
}
private function checkMinlength()
{
$length = explode( '-', $this->validation );
if ( strlen( $this->fieldValue ) < $length[1] )
$this->errorMessages[] = 'moet minimaal uit ' . $length[1] . ' karakters bestaan';
}
private function checkMaxlength()
{
$length = explode( $this->validation, '-' );
if ( strlen( $this->fieldValue ) > $length[1] )
$this->errorMessages[] = 'mag maximaal uit ' . $length[1] . ' karakters bestaan';
}
private function checkMinValue()
{
$value = explode( $this->validation, '-' );
if( $this->fieldValue < $value[1])
$this->errorMessages[] = 'moet minimaal ' . $value[1] . ' zijn';
}
private function checkMaxValue()
{
$value = explode( $this->validation, '-' );
if( $this->fieldValue > $value[1])
$this->errorMessages[] = 'mag maximaal ' . $value[1] . ' zijn';
}
}
@@ -1,91 +0,0 @@
<?php if ( ! defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
/**
* Created by PhpStorm.
* User: imac-3
* Date: 26/06/16
* Time: 21:17
*/
require_once( APPPATH . 'libraries/validation/Validation.php' );
class BaseValidation {
protected $validationField;
protected $key;
protected $fieldValue;
protected $errorMessages = [];
protected $validation;
protected $fieldname;
protected $ci;
protected $validationResult;
public function __construct()
{
$this->ci =& get_instance();
$this->validateInput();
}
public function getValidationResult()
{
return $this->validationResult;
}
public function validateInput()
{
$this->loopFields();
}
public function getErrorMessages( )
{
return $this->errorMessages;
}
private function loopFields()
{
foreach ( $this->validationFields as $this->key => $this->validationField )
{
$this->validation = new Validation();
$this->setInputfield();
$this->validateFieldvalue();
$this->setFieldname();
$this->setValidationResult();
$this->setErrorMesagges();
}
}
private function setInputfield()
{
$this->fieldValue = $this->ci->input->post( $this->key );
}
private function validateFieldvalue()
{
$this->validation->validate( $this->fieldValue, $this->validationField );
}
private function setFieldname()
{
$this->fieldname = $this->validationField['fieldname'];
}
private function setErrorMesagges()
{
$this->errorMessages[ $this->fieldname ] = $this->validation->getErrorMessages();
}
private function setValidationResult()
{
if( $this->validationResult === FALSE ) return;
$this->validationResult = $this->validation->getValidationResult();
}
}
@@ -1,32 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 10/07/16
* Time: 13:35
*/
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
class CustomerValidation extends BaseValidation {
protected $validationFields = [
'name' => [
'validations' => 'required|alphaNumericSpaces',
'fieldname' => 'name'
],
'email' => [
'validations' => 'email',
'fieldname' => 'email'
]
];
public function __construct()
{
parent::__construct();
$this->ci =& get_instance();
}
}
@@ -1,40 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 10/07/16
* Time: 13:35
*/
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
class EmployeeTargetValidation extends BaseValidation {
protected $validationFields = [
'user_id' => [
'validations' => 'required|integer',
'fieldname' => 'gebruiker'
],
'startmonth' => [
'validations' => 'integer',
'fieldname' => 'startmaand'
],
'startyear' => [
'validations' => 'required|integer',
'fieldname' => 'startjaar'
],
'target' =>[
'validations' => 'integer',
'fieldname' => 'uren target'
]
];
public function __construct()
{
parent::__construct();
$this->ci =& get_instance();
}
}
@@ -1,36 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 10/07/16
* Time: 13:35
*/
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
class ExternalValidation extends BaseValidation {
protected $validationFields = [
'contactperson' => [
'validations' => 'required|alphaNumericSpaces',
'fieldname' => 'contact'
],
'email' => [
'validations' => 'email',
'fieldname' => 'email'
],
'rate' => [
'validations' => 'numeric',
'fieldname' => 'tarief'
]
];
public function __construct()
{
parent::__construct();
$this->ci =& get_instance();
}
}
@@ -1,40 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 10/07/16
* Time: 13:35
*/
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
class ForecastValidation extends BaseValidation {
protected $validationFields = [
'project_id' => [
'validations' => 'required|integer',
'fieldname' => 'project'
],
'year' => [
'validations' => 'integer',
'fieldname' => 'jaar'
],
'month_id' => [
'validations' => 'integer',
'fieldname' => 'maand'
],
'forecastamount' => [
'validations' => 'number',
'fieldname' => 'bedrag'
]
];
public function __construct()
{
parent::__construct();
$this->ci =& get_instance();
}
}
@@ -1,44 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 10/07/16
* Time: 13:35
*/
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
class InvoiceValidation extends BaseValidation {
protected $validationFields = [
'project_id' => [
'validations' => 'required|integer',
'fieldname' => 'project'
],
'invoicedate' => [
'validations' => 'date',
'fieldname' => 'factuurdatum'
],
'forecastdate' => [
'validations' => 'date',
'fieldname' => 'prognosedatum'
],
'invoiceamount' => [
'validations' => 'number',
'fieldname' => 'factuurbedrag'
],
'forecastamount' => [
'validations' => 'number',
'fieldname' => 'prognosebedrag'
]
];
public function __construct()
{
parent::__construct();
$this->ci =& get_instance();
}
}
@@ -1,28 +0,0 @@
<?php if ( ! defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
/**
* Created by PhpStorm.
* User: imac-3
* Date: 26/06/16
* Time: 21:13
*/
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
class LoginValidation extends BaseValidation {
protected $validationFields = [
'username' => [
'validations' => 'required|alphaNumericSpaces',
'fieldname' => 'gebruikersnaam'
],
'password' => [
'validations' => 'required',
'fieldname' => 'wachtwoord'
]
];
public function __construct()
{
parent::__construct();
}
}
@@ -1,44 +0,0 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 10/07/16
* Time: 13:35
*/
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
class OfferValidation extends BaseValidation {
protected $validationFields = [
'customer_id' => [
'validations' => 'required|numeric',
'fieldname' => 'klant'
],
'startdate' => [
'validations' => 'required|date',
'fieldname' => 'offertedatum'
],
'acceptdate' => [
'validations' => 'date',
'fieldname' => 'acceptatiedatum'
],
'rejectdate' => [
'validations' => 'date',
'fieldname' => 'afwijsdatum'
],
'acceptance_chance' => [
'validations' => 'numeric',
'fieldname' => 'afwijsdatum|minvalue-0|maxvalue-100'
]
];
public function __construct()
{
parent::__construct();
$this->ci =& get_instance();
}
}
@@ -1,47 +0,0 @@
<?php if ( ! defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
/**
* Created by Pensare Software
* User: Theo Weijmer
* Date: 26/06/16
* Time: 20:39
*/
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
class OrganisationValidation extends BaseValidation {
protected $validationFields = [
'brin' => [
'validations' => 'required|alphaNumeric',
'fieldname' => 'brinnummer'
],
'naam' => [
'validations' => 'required',
'fieldname' => 'Organisatienaam'
],
'naamkort' => [
'validations' => 'required',
'fieldname' => 'Organisatienaam (kort)'
],
'vestiging' => [
'validations' => 'required|alphaNumeric|unique',
'fieldname' => 'vestigingsnummer',
'model' => 'organisations_model',
'field' => 'vestiging'
],
'email' => [
'validations' => 'email',
'fieldname' => 'email'
]
];
public function __construct()
{
parent::__construct();
$this->ci =& get_instance();
}
}
@@ -1,28 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: imac-3
* Date: 26/06/16
* Time: 21:13
*/
require_once( APPPATH . 'libraries/validation/inputValidations/BaseValidation.php' );
class PasswordRequestValidation extends BaseValidation {
protected $validationFields = [
'username' => [
'validations' => 'required|alphaNumericSpaces',
'fieldname' => 'gebruikersnaam'
],
'email' => [
'validations' => 'required|email',
'fieldname' => 'email'
]
];
public function __construct()
{
parent::__construct();
}
}

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