ci_to_3
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
# Matches multiple files with brace expansion notation
|
||||
# Set default charset
|
||||
[*]
|
||||
charset = utf-8
|
||||
|
||||
# Tab indentation (no size specified)
|
||||
indent_style = tab
|
||||
@@ -0,0 +1,32 @@
|
||||
.DS_Store
|
||||
|
||||
application/cache/*
|
||||
!application/cache/index.html
|
||||
|
||||
application/logs/*
|
||||
!application/logs/index.html
|
||||
|
||||
!application/*/.htaccess
|
||||
|
||||
composer.lock
|
||||
tests/mocks/database/ci_test.sqlite
|
||||
|
||||
user_guide_src/build/*
|
||||
user_guide_src/cilexer/build/*
|
||||
user_guide_src/cilexer/dist/*
|
||||
user_guide_src/cilexer/pycilexer.egg-info/*
|
||||
/vendor/
|
||||
|
||||
# IDE Files
|
||||
#-------------------------
|
||||
/nbproject/
|
||||
.idea/*
|
||||
|
||||
## Sublime Text cache files
|
||||
*.tmlanguage.cache
|
||||
*.tmPreferences.cache
|
||||
*.stTheme.cache
|
||||
*.sublime-workspace
|
||||
*.sublime-project
|
||||
/tests/tests/
|
||||
/tests/results/
|
||||
@@ -0,0 +1,15 @@
|
||||
[Fri Nov 18 01:23:31.724975 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/7.4.33 configured -- resuming normal operations
|
||||
[Fri Nov 18 01:23:31.725362 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
|
||||
[Fri Nov 18 01:28:30.448983 2022] [mpm_prefork:notice] [pid 1] AH00170: caught SIGWINCH, shutting down gracefully
|
||||
[Fri Nov 18 01:28:38.846502 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/7.4.33 configured -- resuming normal operations
|
||||
[Fri Nov 18 01:28:38.846765 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
|
||||
[Fri Nov 18 01:43:30.493559 2022] [mpm_prefork:notice] [pid 1] AH00170: caught SIGWINCH, shutting down gracefully
|
||||
[Fri Nov 18 01:43:33.322175 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/7.4.33 configured -- resuming normal operations
|
||||
[Fri Nov 18 01:43:33.322469 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
|
||||
[Fri Nov 18 01:43:48.896358 2022] [autoindex:error] [pid 18] [client 172.24.0.1:47222] AH01276: Cannot serve directory /var/www/html/public/svs/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive
|
||||
[Fri Nov 18 01:46:42.750129 2022] [mpm_prefork:notice] [pid 1] AH00170: caught SIGWINCH, shutting down gracefully
|
||||
[Fri Nov 18 01:46:45.512615 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/7.4.33 configured -- resuming normal operations
|
||||
[Fri Nov 18 01:46:45.512925 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
|
||||
[Sat Nov 19 22:40:16.634065 2022] [mpm_prefork:notice] [pid 1] AH00170: caught SIGWINCH, shutting down gracefully
|
||||
[Sat Nov 19 23:00:20.141921 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/7.4.33 configured -- resuming normal operations
|
||||
[Sat Nov 19 23:00:20.142224 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
|
||||
@@ -0,0 +1,18 @@
|
||||
wrenchboard-api:80 172.24.0.1 - - [18/Nov/2022:01:30:56 +0000] "GET / HTTP/1.1" 200 6388 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
|
||||
wrenchboard-api:80 172.24.0.1 - - [18/Nov/2022:01:30:57 +0000] "GET /favicon.ico HTTP/1.1" 200 5731 "http://localhost:9083/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
|
||||
wrenchboard-api:80 172.24.0.1 - - [18/Nov/2022:01:30:59 +0000] "GET / HTTP/1.1" 200 6387 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
|
||||
wrenchboard-api:80 172.24.0.1 - - [18/Nov/2022:01:31:48 +0000] "-" 408 0 "-" "-"
|
||||
wrenchboard-api:80 172.24.0.1 - - [18/Nov/2022:01:43:48 +0000] "GET /svs/ HTTP/1.1" 403 416 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
|
||||
wrenchboard-api:80 172.24.0.1 - - [18/Nov/2022:01:43:54 +0000] "GET /svs/users/ HTTP/1.1" 301 507 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
|
||||
wrenchboard-api:80 172.24.0.1 - - [18/Nov/2022:01:43:54 +0000] "GET /svs/users HTTP/1.1" 404 2165 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
|
||||
wrenchboard-api:80 172.24.0.1 - - [18/Nov/2022:01:43:58 +0000] "GET /svs/users HTTP/1.1" 404 2165 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
|
||||
wrenchboard-api:80 172.24.0.1 - - [18/Nov/2022:01:44:33 +0000] "GET /svs/user/ HTTP/1.1" 400 3599 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
|
||||
wrenchboard-api:80 172.24.0.1 - - [18/Nov/2022:01:45:25 +0000] "-" 408 0 "-" "-"
|
||||
wrenchboard-api:80 172.24.0.1 - - [18/Nov/2022:01:47:52 +0000] "GET /svs/user/ HTTP/1.1" 400 519 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
|
||||
wrenchboard-api:80 172.24.0.1 - - [18/Nov/2022:01:47:52 +0000] "GET /favicon.ico HTTP/1.1" 304 250 "http://localhost:9083/svs/user/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
|
||||
wrenchboard-api:80 172.24.0.1 - - [18/Nov/2022:02:27:41 +0000] "GET / HTTP/1.1" 200 6388 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
|
||||
wrenchboard-api:80 172.24.0.1 - - [18/Nov/2022:02:27:42 +0000] "GET /favicon.ico HTTP/1.1" 200 5731 "http://10.0.0.202:9083/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
|
||||
wrenchboard-api:80 172.24.0.1 - - [18/Nov/2022:02:28:34 +0000] "-" 408 0 "-" "-"
|
||||
wrenchboard-api:80 172.25.0.1 - - [19/Nov/2022:23:01:00 +0000] "GET / HTTP/1.1" 200 6388 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
|
||||
wrenchboard-api:80 172.25.0.1 - - [19/Nov/2022:23:01:01 +0000] "GET /favicon.ico HTTP/1.1" 200 5731 "http://localhost:9083/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
|
||||
wrenchboard-api:80 172.25.0.1 - - [19/Nov/2022:23:01:52 +0000] "-" 408 0 "-" "-"
|
||||
@@ -0,0 +1,6 @@
|
||||
<IfModule authz_core_module>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
<IfModule !authz_core_module>
|
||||
Deny from all
|
||||
</IfModule>
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,135 @@
|
||||
<?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();
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| 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();
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| 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'] = array();
|
||||
@@ -0,0 +1,532 @@
|
||||
<?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 to guess the protocol and
|
||||
| path to 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/userguide3/general/urls.html
|
||||
|
|
||||
| Note: This option is ignored for CLI requests.
|
||||
*/
|
||||
$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'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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/userguide3/general/core_classes.html
|
||||
| https://codeigniter.com/userguide3/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'] = 0;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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/userguide3/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_samesite'
|
||||
|
|
||||
| Session cookie SameSite attribute: Lax (default), Strict or None
|
||||
|
|
||||
| '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'] = 'files';
|
||||
$config['sess_cookie_name'] = 'ci_session';
|
||||
$config['sess_samesite'] = 'Lax';
|
||||
$config['sess_expiration'] = 7200;
|
||||
$config['sess_save_path'] = NULL;
|
||||
$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)
|
||||
| 'cookie_samesite' = Cookie's samesite attribute (Lax, Strict or None)
|
||||
|
|
||||
| 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;
|
||||
$config['cookie_samesite'] = 'Lax';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'] = array();
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'] = '';
|
||||
@@ -0,0 +1,85 @@
|
||||
<?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
|
||||
@@ -0,0 +1,96 @@
|
||||
<?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 certificates 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
|
||||
|
|
||||
| ['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' => 'localhost',
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
'database' => '',
|
||||
'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
|
||||
);
|
||||
@@ -0,0 +1,24 @@
|
||||
<?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">'
|
||||
);
|
||||
@@ -0,0 +1,114 @@
|
||||
<?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',
|
||||
'/Θ/' => 'TH',
|
||||
'/θ/' => 'th',
|
||||
'/Ķ|Κ|К/' => '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',
|
||||
'/Φ/' => 'F',
|
||||
'/φ/' => 'f',
|
||||
'/Χ/' => 'CH',
|
||||
'/χ/' => 'ch',
|
||||
'/Ź|Ż|Ž|Ζ|З/' => 'Z',
|
||||
'/ź|ż|ž|ζ|з/' => 'z',
|
||||
'/Æ|Ǽ/' => 'AE',
|
||||
'/ß/' => 'ss',
|
||||
'/IJ/' => 'IJ',
|
||||
'/ij/' => 'ij',
|
||||
'/Œ/' => 'OE',
|
||||
'/ƒ/' => 'f',
|
||||
'/Ξ/' => 'KS',
|
||||
'/ξ/' => 'ks',
|
||||
'/Π/' => 'P',
|
||||
'/π/' => 'p',
|
||||
'/Β/' => 'V',
|
||||
'/β/' => 'v',
|
||||
'/Μ/' => 'M',
|
||||
'/μ/' => 'm',
|
||||
'/Ψ/' => 'PS',
|
||||
'/ψ/' => 'ps',
|
||||
'/Ё/' => 'Yo',
|
||||
'/ё/' => 'yo',
|
||||
'/Є/' => 'Ye',
|
||||
'/є/' => 'ye',
|
||||
'/Ї/' => 'Yi',
|
||||
'/Ж/' => 'Zh',
|
||||
'/ж/' => 'zh',
|
||||
'/Х/' => 'Kh',
|
||||
'/х/' => 'kh',
|
||||
'/Ц/' => 'Ts',
|
||||
'/ц/' => 'ts',
|
||||
'/Ч/' => 'Ch',
|
||||
'/ч/' => 'ch',
|
||||
'/Ш/' => 'Sh',
|
||||
'/ш/' => 'sh',
|
||||
'/Щ/' => 'Shch',
|
||||
'/щ/' => 'shch',
|
||||
'/Ъ|ъ|Ь|ь/' => '',
|
||||
'/Ю/' => 'Yu',
|
||||
'/ю/' => 'yu',
|
||||
'/Я/' => 'Ya',
|
||||
'/я/' => 'ya'
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
<?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/userguide3/general/hooks.html
|
||||
|
|
||||
*/
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Memcached settings
|
||||
| -------------------------------------------------------------------------
|
||||
| Your Memcached servers can be specified below.
|
||||
|
|
||||
| See: https://codeigniter.com/userguide3/libraries/caching.html#memcached
|
||||
|
|
||||
*/
|
||||
$config = array(
|
||||
'default' => array(
|
||||
'hostname' => '127.0.0.1',
|
||||
'port' => '11211',
|
||||
'weight' => '1',
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,84 @@
|
||||
<?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/';
|
||||
@@ -0,0 +1,186 @@
|
||||
<?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',
|
||||
'heic' => 'image/heic',
|
||||
'heif' => 'image/heif',
|
||||
'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' => array('audio/x-aac', 'audio/aac'),
|
||||
'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',
|
||||
'7z' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
|
||||
'7zip' => array('application/x-7z-compressed', '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', 'image/svg', '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'
|
||||
);
|
||||
@@ -0,0 +1,14 @@
|
||||
<?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/userguide3/general/profiling.html
|
||||
|
|
||||
*/
|
||||
@@ -0,0 +1,54 @@
|
||||
<?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/userguide3/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'] = 'welcome';
|
||||
$route['404_override'] = '';
|
||||
$route['translate_uri_dashes'] = FALSE;
|
||||
@@ -0,0 +1,64 @@
|
||||
<?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/userguide3/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')
|
||||
|
||||
);
|
||||
@@ -0,0 +1,222 @@
|
||||
<?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' => 'Edge',
|
||||
'Chrome' => 'Chrome',
|
||||
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
|
||||
'Opera.*?Version' => 'Opera',
|
||||
'Opera' => 'Opera',
|
||||
'MSIE' => 'Internet Explorer',
|
||||
'Internet Explorer' => 'Internet Explorer',
|
||||
'Trident.* rv' => 'Internet Explorer',
|
||||
'Shiira' => 'Shiira',
|
||||
'Firefox' => 'Firefox',
|
||||
'Chimera' => 'Chimera',
|
||||
'Phoenix' => 'Phoenix',
|
||||
'Firebird' => 'Firebird',
|
||||
'Camino' => 'Camino',
|
||||
'Netscape' => 'Netscape',
|
||||
'OmniWeb' => 'OmniWeb',
|
||||
'Safari' => 'Safari',
|
||||
'Mozilla' => 'Mozilla',
|
||||
'Konqueror' => 'Konqueror',
|
||||
'icab' => 'iCab',
|
||||
'Lynx' => 'Lynx',
|
||||
'Links' => 'Links',
|
||||
'hotjava' => 'HotJava',
|
||||
'amaya' => 'Amaya',
|
||||
'IBrowse' => 'IBrowse',
|
||||
'Maxthon' => 'Maxthon',
|
||||
'Ubuntu' => 'Ubuntu Web Browser'
|
||||
);
|
||||
|
||||
$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',
|
||||
'nexus' => 'Nexus',
|
||||
'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',
|
||||
'meizu' => 'Meizu',
|
||||
'huawei' => 'Huawei',
|
||||
'xiaomi' => 'Xiaomi',
|
||||
'oppo' => 'Oppo',
|
||||
'vivo' => 'Vivo',
|
||||
'infinix' => 'Infinix',
|
||||
|
||||
// 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',
|
||||
'UptimeRobot' => 'UptimeRobot'
|
||||
);
|
||||
@@ -0,0 +1,25 @@
|
||||
<?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/userguide3/general/urls.html
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('welcome_message');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
echo "\nERROR: ",
|
||||
$heading,
|
||||
"\n\n",
|
||||
$message,
|
||||
"\n\n";
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
echo "\nDatabase error: ",
|
||||
$heading,
|
||||
"\n\n",
|
||||
$message,
|
||||
"\n\n";
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
|
||||
|
||||
An uncaught Exception was encountered
|
||||
|
||||
Type: <?php echo get_class($exception), "\n"; ?>
|
||||
Message: <?php echo $message, "\n"; ?>
|
||||
Filename: <?php echo $exception->getFile(), "\n"; ?>
|
||||
Line Number: <?php echo $exception->getLine(); ?>
|
||||
|
||||
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
|
||||
|
||||
Backtrace:
|
||||
<?php foreach ($exception->getTrace() as $error): ?>
|
||||
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
|
||||
File: <?php echo $error['file'], "\n"; ?>
|
||||
Line: <?php echo $error['line'], "\n"; ?>
|
||||
Function: <?php echo $error['function'], "\n\n"; ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
|
||||
<?php endif ?>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
echo "\nERROR: ",
|
||||
$heading,
|
||||
"\n\n",
|
||||
$message,
|
||||
"\n\n";
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
|
||||
|
||||
A PHP Error was encountered
|
||||
|
||||
Severity: <?php echo $severity, "\n"; ?>
|
||||
Message: <?php echo $message, "\n"; ?>
|
||||
Filename: <?php echo $filepath, "\n"; ?>
|
||||
Line Number: <?php echo $line; ?>
|
||||
|
||||
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
|
||||
|
||||
Backtrace:
|
||||
<?php foreach (debug_backtrace() as $error): ?>
|
||||
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
|
||||
File: <?php echo $error['file'], "\n"; ?>
|
||||
Line: <?php echo $error['line'], "\n"; ?>
|
||||
Function: <?php echo $error['function'], "\n\n"; ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
|
||||
<?php endif ?>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
?><!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>404 Page Not Found</title>
|
||||
<style type="text/css">
|
||||
|
||||
::selection { background-color: #E13300; color: white; }
|
||||
::-moz-selection { background-color: #E13300; color: white; }
|
||||
|
||||
body {
|
||||
background-color: #fff;
|
||||
margin: 40px;
|
||||
font: 13px/20px normal Helvetica, Arial, sans-serif;
|
||||
color: #4F5155;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #003399;
|
||||
background-color: transparent;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #444;
|
||||
background-color: transparent;
|
||||
border-bottom: 1px solid #D0D0D0;
|
||||
font-size: 19px;
|
||||
font-weight: normal;
|
||||
margin: 0 0 14px 0;
|
||||
padding: 14px 15px 10px 15px;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: Consolas, Monaco, Courier New, Courier, monospace;
|
||||
font-size: 12px;
|
||||
background-color: #f9f9f9;
|
||||
border: 1px solid #D0D0D0;
|
||||
color: #002166;
|
||||
display: block;
|
||||
margin: 14px 0 14px 0;
|
||||
padding: 12px 10px 12px 10px;
|
||||
}
|
||||
|
||||
#container {
|
||||
margin: 10px;
|
||||
border: 1px solid #D0D0D0;
|
||||
box-shadow: 0 0 8px #D0D0D0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 12px 15px 12px 15px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<h1><?php echo $heading; ?></h1>
|
||||
<?php echo $message; ?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
?><!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Database Error</title>
|
||||
<style type="text/css">
|
||||
|
||||
::selection { background-color: #E13300; color: white; }
|
||||
::-moz-selection { background-color: #E13300; color: white; }
|
||||
|
||||
body {
|
||||
background-color: #fff;
|
||||
margin: 40px;
|
||||
font: 13px/20px normal Helvetica, Arial, sans-serif;
|
||||
color: #4F5155;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #003399;
|
||||
background-color: transparent;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #444;
|
||||
background-color: transparent;
|
||||
border-bottom: 1px solid #D0D0D0;
|
||||
font-size: 19px;
|
||||
font-weight: normal;
|
||||
margin: 0 0 14px 0;
|
||||
padding: 14px 15px 10px 15px;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: Consolas, Monaco, Courier New, Courier, monospace;
|
||||
font-size: 12px;
|
||||
background-color: #f9f9f9;
|
||||
border: 1px solid #D0D0D0;
|
||||
color: #002166;
|
||||
display: block;
|
||||
margin: 14px 0 14px 0;
|
||||
padding: 12px 10px 12px 10px;
|
||||
}
|
||||
|
||||
#container {
|
||||
margin: 10px;
|
||||
border: 1px solid #D0D0D0;
|
||||
box-shadow: 0 0 8px #D0D0D0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 12px 15px 12px 15px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<h1><?php echo $heading; ?></h1>
|
||||
<?php echo $message; ?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
?>
|
||||
|
||||
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
|
||||
|
||||
<h4>An uncaught Exception was encountered</h4>
|
||||
|
||||
<p>Type: <?php echo get_class($exception); ?></p>
|
||||
<p>Message: <?php echo $message; ?></p>
|
||||
<p>Filename: <?php echo $exception->getFile(); ?></p>
|
||||
<p>Line Number: <?php echo $exception->getLine(); ?></p>
|
||||
|
||||
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
|
||||
|
||||
<p>Backtrace:</p>
|
||||
<?php foreach ($exception->getTrace() as $error): ?>
|
||||
|
||||
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
|
||||
|
||||
<p style="margin-left:10px">
|
||||
File: <?php echo $error['file']; ?><br />
|
||||
Line: <?php echo $error['line']; ?><br />
|
||||
Function: <?php echo $error['function']; ?>
|
||||
</p>
|
||||
<?php endif ?>
|
||||
|
||||
<?php endforeach ?>
|
||||
|
||||
<?php endif ?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
?><!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Error</title>
|
||||
<style type="text/css">
|
||||
|
||||
::selection { background-color: #E13300; color: white; }
|
||||
::-moz-selection { background-color: #E13300; color: white; }
|
||||
|
||||
body {
|
||||
background-color: #fff;
|
||||
margin: 40px;
|
||||
font: 13px/20px normal Helvetica, Arial, sans-serif;
|
||||
color: #4F5155;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #003399;
|
||||
background-color: transparent;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #444;
|
||||
background-color: transparent;
|
||||
border-bottom: 1px solid #D0D0D0;
|
||||
font-size: 19px;
|
||||
font-weight: normal;
|
||||
margin: 0 0 14px 0;
|
||||
padding: 14px 15px 10px 15px;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: Consolas, Monaco, Courier New, Courier, monospace;
|
||||
font-size: 12px;
|
||||
background-color: #f9f9f9;
|
||||
border: 1px solid #D0D0D0;
|
||||
color: #002166;
|
||||
display: block;
|
||||
margin: 14px 0 14px 0;
|
||||
padding: 12px 10px 12px 10px;
|
||||
}
|
||||
|
||||
#container {
|
||||
margin: 10px;
|
||||
border: 1px solid #D0D0D0;
|
||||
box-shadow: 0 0 8px #D0D0D0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 12px 15px 12px 15px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<h1><?php echo $heading; ?></h1>
|
||||
<?php echo $message; ?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
?>
|
||||
|
||||
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
|
||||
|
||||
<h4>A PHP Error was encountered</h4>
|
||||
|
||||
<p>Severity: <?php echo $severity; ?></p>
|
||||
<p>Message: <?php echo $message; ?></p>
|
||||
<p>Filename: <?php echo $filepath; ?></p>
|
||||
<p>Line Number: <?php echo $line; ?></p>
|
||||
|
||||
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
|
||||
|
||||
<p>Backtrace:</p>
|
||||
<?php foreach (debug_backtrace() as $error): ?>
|
||||
|
||||
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
|
||||
|
||||
<p style="margin-left:10px">
|
||||
File: <?php echo $error['file'] ?><br />
|
||||
Line: <?php echo $error['line'] ?><br />
|
||||
Function: <?php echo $error['function'] ?>
|
||||
</p>
|
||||
|
||||
<?php endif ?>
|
||||
|
||||
<?php endforeach ?>
|
||||
|
||||
<?php endif ?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
?><!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Welcome to CodeIgniter</title>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
::selection { background-color: #E13300; color: white; }
|
||||
::-moz-selection { background-color: #E13300; color: white; }
|
||||
|
||||
body {
|
||||
background-color: #fff;
|
||||
margin: 40px;
|
||||
font: 13px/20px normal Helvetica, Arial, sans-serif;
|
||||
color: #4F5155;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #003399;
|
||||
background-color: transparent;
|
||||
font-weight: normal;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #97310e;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #444;
|
||||
background-color: transparent;
|
||||
border-bottom: 1px solid #D0D0D0;
|
||||
font-size: 19px;
|
||||
font-weight: normal;
|
||||
margin: 0 0 14px 0;
|
||||
padding: 14px 15px 10px 15px;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: Consolas, Monaco, Courier New, Courier, monospace;
|
||||
font-size: 12px;
|
||||
background-color: #f9f9f9;
|
||||
border: 1px solid #D0D0D0;
|
||||
color: #002166;
|
||||
display: block;
|
||||
margin: 14px 0 14px 0;
|
||||
padding: 12px 10px 12px 10px;
|
||||
}
|
||||
|
||||
#body {
|
||||
margin: 0 15px 0 15px;
|
||||
min-height: 96px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0 0 10px;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
p.footer {
|
||||
text-align: right;
|
||||
font-size: 11px;
|
||||
border-top: 1px solid #D0D0D0;
|
||||
line-height: 32px;
|
||||
padding: 0 10px 0 10px;
|
||||
margin: 20px 0 0 0;
|
||||
}
|
||||
|
||||
#container {
|
||||
margin: 10px;
|
||||
border: 1px solid #D0D0D0;
|
||||
box-shadow: 0 0 8px #D0D0D0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
<h1>Welcome to CodeIgniter!</h1>
|
||||
|
||||
<div id="body">
|
||||
<p>The page you are looking at is being generated dynamically by CodeIgniter.</p>
|
||||
|
||||
<p>If you would like to edit this page you'll find it located at:</p>
|
||||
<code>application/views/welcome_message.php</code>
|
||||
|
||||
<p>The corresponding controller for this page is found at:</p>
|
||||
<code>application/controllers/Welcome.php</code>
|
||||
|
||||
<p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a href="userguide3/">User Guide</a>.</p>
|
||||
</div>
|
||||
|
||||
<p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds. <?php echo (ENVIRONMENT === 'development') ? 'CodeIgniter Version <strong>' . CI_VERSION . '</strong>' : '' ?></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"description": "The CodeIgniter framework",
|
||||
"name": "codeigniter/framework",
|
||||
"type": "project",
|
||||
"homepage": "https://codeigniter.com",
|
||||
"license": "MIT",
|
||||
"support": {
|
||||
"forum": "http://forum.codeigniter.com/",
|
||||
"wiki": "https://github.com/bcit-ci/CodeIgniter/wiki",
|
||||
"slack": "https://codeigniterchat.slack.com",
|
||||
"source": "https://github.com/bcit-ci/CodeIgniter"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.7"
|
||||
},
|
||||
"suggest": {
|
||||
"paragonie/random_compat": "Provides better randomness in PHP 5.x"
|
||||
},
|
||||
"scripts": {
|
||||
"test:coverage": [
|
||||
"@putenv XDEBUG_MODE=coverage",
|
||||
"phpunit --color=always --coverage-text --configuration tests/travis/sqlite.phpunit.xml"
|
||||
],
|
||||
"post-install-cmd": [
|
||||
"sed -i s/name{0}/name[0]/ vendor/mikey179/vfsstream/src/main/php/org/bovigo/vfs/vfsStream.php"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"sed -i s/name{0}/name[0]/ vendor/mikey179/vfsstream/src/main/php/org/bovigo/vfs/vfsStream.php"
|
||||
]
|
||||
},
|
||||
"require-dev": {
|
||||
"mikey179/vfsstream": "1.6.*",
|
||||
"phpunit/phpunit": "4.* || 5.* || 9.*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* APPLICATION ENVIRONMENT
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* You can load different configurations depending on your
|
||||
* current environment. Setting the environment also influences
|
||||
* things like logging and error reporting.
|
||||
*
|
||||
* This can be set to anything, but default usage is:
|
||||
*
|
||||
* development
|
||||
* testing
|
||||
* production
|
||||
*
|
||||
* NOTE: If you change these, also change the error_reporting() code below
|
||||
*/
|
||||
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* ERROR REPORTING
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* Different environments will require different levels of error reporting.
|
||||
* By default development will show errors but testing and live will hide them.
|
||||
*/
|
||||
switch (ENVIRONMENT)
|
||||
{
|
||||
case 'development':
|
||||
error_reporting(-1);
|
||||
ini_set('display_errors', 1);
|
||||
break;
|
||||
|
||||
case 'testing':
|
||||
case 'production':
|
||||
ini_set('display_errors', 0);
|
||||
if (version_compare(PHP_VERSION, '5.3', '>='))
|
||||
{
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
||||
}
|
||||
else
|
||||
{
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
||||
echo 'The application environment is not set correctly.';
|
||||
exit(1); // EXIT_ERROR
|
||||
}
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* SYSTEM DIRECTORY NAME
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* This variable must contain the name of your "system" directory.
|
||||
* Set the path if it is not in the same directory as this file.
|
||||
*/
|
||||
$system_path = 'system';
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* APPLICATION DIRECTORY NAME
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* If you want this front controller to use a different "application"
|
||||
* directory than the default one you can set its name here. The directory
|
||||
* can also be renamed or relocated anywhere on your server. If you do,
|
||||
* use an absolute (full) server path.
|
||||
* For more info please see the user guide:
|
||||
*
|
||||
* https://codeigniter.com/userguide3/general/managing_apps.html
|
||||
*
|
||||
* NO TRAILING SLASH!
|
||||
*/
|
||||
$application_folder = 'application';
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* VIEW DIRECTORY NAME
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* If you want to move the view directory out of the application
|
||||
* directory, set the path to it here. The directory can be renamed
|
||||
* and relocated anywhere on your server. If blank, it will default
|
||||
* to the standard location inside your application directory.
|
||||
* If you do move this, use an absolute (full) server path.
|
||||
*
|
||||
* NO TRAILING SLASH!
|
||||
*/
|
||||
$view_folder = '';
|
||||
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* DEFAULT CONTROLLER
|
||||
* --------------------------------------------------------------------
|
||||
*
|
||||
* Normally you will set your default controller in the routes.php file.
|
||||
* You can, however, force a custom routing by hard-coding a
|
||||
* specific controller class/function here. For most applications, you
|
||||
* WILL NOT set your routing here, but it's an option for those
|
||||
* special instances where you might want to override the standard
|
||||
* routing in a specific front controller that shares a common CI installation.
|
||||
*
|
||||
* IMPORTANT: If you set the routing here, NO OTHER controller will be
|
||||
* callable. In essence, this preference limits your application to ONE
|
||||
* specific controller. Leave the function name blank if you need
|
||||
* to call functions dynamically via the URI.
|
||||
*
|
||||
* Un-comment the $routing array below to use this feature
|
||||
*/
|
||||
// The directory name, relative to the "controllers" directory. Leave blank
|
||||
// if your controller is not in a sub-directory within the "controllers" one
|
||||
// $routing['directory'] = '';
|
||||
|
||||
// The controller class file name. Example: mycontroller
|
||||
// $routing['controller'] = '';
|
||||
|
||||
// The controller function you wish to be called.
|
||||
// $routing['function'] = '';
|
||||
|
||||
|
||||
/*
|
||||
* -------------------------------------------------------------------
|
||||
* CUSTOM CONFIG VALUES
|
||||
* -------------------------------------------------------------------
|
||||
*
|
||||
* The $assign_to_config array below will be passed dynamically to the
|
||||
* config class when initialized. This allows you to set custom config
|
||||
* items or override any default config values found in the config.php file.
|
||||
* This can be handy as it permits you to share one application between
|
||||
* multiple front controller files, with each file containing different
|
||||
* config values.
|
||||
*
|
||||
* Un-comment the $assign_to_config array below to use this feature
|
||||
*/
|
||||
// $assign_to_config['name_of_config_item'] = 'value of config item';
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------
|
||||
* Resolve the system path for increased reliability
|
||||
* ---------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// Set the current directory correctly for CLI requests
|
||||
if (defined('STDIN'))
|
||||
{
|
||||
chdir(dirname(__FILE__));
|
||||
}
|
||||
|
||||
if (($_temp = realpath($system_path)) !== FALSE)
|
||||
{
|
||||
$system_path = $_temp.DIRECTORY_SEPARATOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ensure there's a trailing slash
|
||||
$system_path = strtr(
|
||||
rtrim($system_path, '/\\'),
|
||||
'/\\',
|
||||
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
||||
).DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
// Is the system path correct?
|
||||
if ( ! is_dir($system_path))
|
||||
{
|
||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
||||
echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
|
||||
exit(3); // EXIT_CONFIG
|
||||
}
|
||||
|
||||
/*
|
||||
* -------------------------------------------------------------------
|
||||
* Now that we know the path, set the main path constants
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
// The name of THIS file
|
||||
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
|
||||
|
||||
// Path to the system directory
|
||||
define('BASEPATH', $system_path);
|
||||
|
||||
// Path to the front controller (this file) directory
|
||||
define('FCPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
|
||||
|
||||
// Name of the "system" directory
|
||||
define('SYSDIR', basename(BASEPATH));
|
||||
|
||||
// The path to the "application" directory
|
||||
if (is_dir($application_folder))
|
||||
{
|
||||
if (($_temp = realpath($application_folder)) !== FALSE)
|
||||
{
|
||||
$application_folder = $_temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
$application_folder = strtr(
|
||||
rtrim($application_folder, '/\\'),
|
||||
'/\\',
|
||||
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
}
|
||||
elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
|
||||
{
|
||||
$application_folder = BASEPATH.strtr(
|
||||
trim($application_folder, '/\\'),
|
||||
'/\\',
|
||||
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
||||
echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
|
||||
exit(3); // EXIT_CONFIG
|
||||
}
|
||||
|
||||
define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
|
||||
|
||||
// The path to the "views" directory
|
||||
if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
|
||||
{
|
||||
$view_folder = APPPATH.'views';
|
||||
}
|
||||
elseif (is_dir($view_folder))
|
||||
{
|
||||
if (($_temp = realpath($view_folder)) !== FALSE)
|
||||
{
|
||||
$view_folder = $_temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
$view_folder = strtr(
|
||||
rtrim($view_folder, '/\\'),
|
||||
'/\\',
|
||||
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
}
|
||||
elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
|
||||
{
|
||||
$view_folder = APPPATH.strtr(
|
||||
trim($view_folder, '/\\'),
|
||||
'/\\',
|
||||
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
||||
echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
|
||||
exit(3); // EXIT_CONFIG
|
||||
}
|
||||
|
||||
define('VIEWPATH', $view_folder.DIRECTORY_SEPARATOR);
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* LOAD THE BOOTSTRAP FILE
|
||||
* --------------------------------------------------------------------
|
||||
*
|
||||
* And away we go...
|
||||
*/
|
||||
require_once BASEPATH.'core/CodeIgniter.php';
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -1,49 +0,0 @@
|
||||
# Disable directory browsing
|
||||
Options All -Indexes
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Rewrite engine
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Turning on the rewrite engine is necessary for the following rules and features.
|
||||
# FollowSymLinks must be enabled for this to work.
|
||||
<IfModule mod_rewrite.c>
|
||||
Options +FollowSymlinks
|
||||
RewriteEngine On
|
||||
|
||||
# If you installed CodeIgniter in a subfolder, you will need to
|
||||
# change the following line to match the subfolder you need.
|
||||
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
|
||||
# RewriteBase /
|
||||
|
||||
# Redirect Trailing Slashes...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} (.+)/$
|
||||
RewriteRule ^ %1 [L,R=301]
|
||||
|
||||
# Rewrite "www.example.com -> example.com"
|
||||
RewriteCond %{HTTPS} !=on
|
||||
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
|
||||
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
|
||||
|
||||
# Checks to see if the user is attempting to access a valid file,
|
||||
# such as an image or css document, if this isn't true it sends the
|
||||
# request to the front controller, index.php
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]
|
||||
|
||||
# Ensure Authorization header is passed along
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
</IfModule>
|
||||
|
||||
<IfModule !mod_rewrite.c>
|
||||
# If we don't have mod_rewrite installed, all 404's
|
||||
# can be sent to index.php, and everything works as normal.
|
||||
ErrorDocument 404 index.php
|
||||
</IfModule>
|
||||
|
||||
# Disable server signature start
|
||||
ServerSignature Off
|
||||
# Disable server signature end
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
if (!array_key_exists('wrenchboard', $GLOBALS)) {
|
||||
class WrenchBoardAPIWrapper {
|
||||
const DEBUG_API_CALLS = true;
|
||||
public $wrenchboard;
|
||||
public $USER = 'root';
|
||||
public function __construct()
|
||||
{
|
||||
$USER = $_SERVER['SCRIPT_FILENAME'];
|
||||
$USER = str_replace('/home', '', $USER);
|
||||
$USER = strtok($USER, '/');
|
||||
if ($USER=='opt') $USER = 'root';
|
||||
// Load API class
|
||||
$USER = 'root';
|
||||
$this->USER = $USER;
|
||||
}
|
||||
|
||||
public function wrenchboard_api($in, $out = array()) {
|
||||
if (!is_array($in)) {
|
||||
$in = array();
|
||||
}
|
||||
if (!is_array($out)) {
|
||||
$out = array();
|
||||
}
|
||||
if (self::DEBUG_API_CALLS) {
|
||||
$stack = debug_backtrace();
|
||||
$log = json_encode($stack);
|
||||
error_log($log);
|
||||
error_log(json_encode($in));
|
||||
}
|
||||
$this->wrenchboard_load();
|
||||
return $this->wrenchboard->wrenchboard_api($in, $out);
|
||||
}
|
||||
|
||||
public function logMessage($in) {
|
||||
if ($in == null || trim($in) == "") {
|
||||
return null;
|
||||
}
|
||||
if (self::DEBUG_API_CALLS) {
|
||||
$stack = debug_backtrace();
|
||||
$log = json_encode($stack);
|
||||
error_log($log);
|
||||
error_log($in);
|
||||
}
|
||||
$this->wrenchboard_load();
|
||||
return $this->wrenchboard->logMessage($in);
|
||||
}
|
||||
|
||||
public function cfgReadChar($in) {
|
||||
if ($in == null || trim($in) == "") {
|
||||
return null;
|
||||
}
|
||||
if (self::DEBUG_API_CALLS) {
|
||||
$stack = debug_backtrace();
|
||||
$log = json_encode($stack);
|
||||
error_log($log);
|
||||
error_log($in);
|
||||
}
|
||||
$this->wrenchboard_load();
|
||||
return $this->wrenchboard->cfgReadChar($in);
|
||||
}
|
||||
|
||||
public function cfgReadLong($in) {
|
||||
if ($in == null || trim($in) == "") {
|
||||
return 0;
|
||||
}
|
||||
if (self::DEBUG_API_CALLS) {
|
||||
$stack = debug_backtrace();
|
||||
$log = json_encode($stack);
|
||||
error_log($log);
|
||||
error_log($in);
|
||||
}
|
||||
$this->wrenchboard_load();
|
||||
return $this->wrenchboard->cfgReadLong($in);
|
||||
}
|
||||
|
||||
private function wrenchboard_load() {
|
||||
// global $wrenchboard;
|
||||
// $this->$USER = $_SERVER['SCRIPT_FILENAME'];
|
||||
$wrenchboard_class = 'wrenchboard_api_' . $this->USER . '\\WrenchBoard';
|
||||
if (!is_object($this->wrenchboard)) {
|
||||
$this->wrenchboard = new $wrenchboard_class();
|
||||
}
|
||||
/* if (is_object($wrenchboard) && is_object($wrenchboard->wrenchboard)) {
|
||||
$this->wrenchboard = $wrenchboard->wrenchboard;
|
||||
} else if (is_object($wrenchboard)) {
|
||||
$this->wrenchboard = $wrenchboard;
|
||||
} else if (!is_object($this->wrenchboard)) {
|
||||
$this->wrenchboard = new $wrenchboard_class();
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
global $wrenchboard;
|
||||
$wrenchboard = new WrenchBoardAPIWrapper();
|
||||
}
|
||||
?>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.3 KiB |
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Check PHP version.
|
||||
$minPhpVersion = '7.4'; // If you update this, don't forget to update `spark`.
|
||||
if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
|
||||
$message = sprintf(
|
||||
'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
|
||||
$minPhpVersion,
|
||||
PHP_VERSION
|
||||
);
|
||||
|
||||
exit($message);
|
||||
}
|
||||
|
||||
// Path to the front controller (this file)
|
||||
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR);
|
||||
|
||||
// Ensure the current directory is pointing to the front controller's directory
|
||||
chdir(FCPATH);
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* BOOTSTRAP THE APPLICATION
|
||||
*---------------------------------------------------------------
|
||||
* This process sets up the path constants, loads and registers
|
||||
* our autoloader, along with Composer's, loads our constants
|
||||
* and fires up an environment-specific bootstrapping.
|
||||
*/
|
||||
|
||||
// Load our paths config file
|
||||
// This is the line that might need to be changed, depending on your folder structure.
|
||||
require FCPATH . '../app/Config/Paths.php';
|
||||
// ^^^ Change this line if you move your application folder
|
||||
|
||||
$paths = new Config\Paths();
|
||||
|
||||
// Location of the framework bootstrap file.
|
||||
require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';
|
||||
|
||||
// Load environment settings from .env files into $_SERVER and $_ENV
|
||||
require_once SYSTEMPATH . 'Config/DotEnv.php';
|
||||
(new CodeIgniter\Config\DotEnv(ROOTPATH))->load();
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------
|
||||
* GRAB OUR CODEIGNITER INSTANCE
|
||||
* ---------------------------------------------------------------
|
||||
*
|
||||
* The CodeIgniter class contains the core functionality to make
|
||||
* the application run, and does all of the dirty work to get
|
||||
* the pieces all working together.
|
||||
*/
|
||||
|
||||
$app = Config\Services::codeigniter();
|
||||
$app->initialize();
|
||||
$context = is_cli() ? 'php-cli' : 'web';
|
||||
$app->setContext($context);
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* LAUNCH THE APPLICATION
|
||||
*---------------------------------------------------------------
|
||||
* Now that everything is setup, it's time to actually fire
|
||||
* up the engines and make this app do its thang.
|
||||
*/
|
||||
|
||||
$app->run();
|
||||
@@ -1,2 +0,0 @@
|
||||
User-agent: *
|
||||
Disallow:
|
||||
@@ -0,0 +1,22 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
|
||||
RewriteEngine On
|
||||
RewriteBase /svs/api/
|
||||
#RewriteBase /
|
||||
|
||||
#Checks to
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php?endpoint=$1 [L,NC,QSA]
|
||||
|
||||
</IfModule>
|
||||
|
||||
<IfModule !mod_rewrite.c>
|
||||
# If we don't have mod_rewrite installed, all 404's
|
||||
# can be sent to index.php, and everything works as normal.
|
||||
# Submitted by: ElliotHaughin
|
||||
|
||||
ErrorDocument 404 /index.php
|
||||
|
||||
</IfModule>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
include 'index_backend.php';
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
include '../../backend.php';
|
||||
include 'constants.php';
|
||||
include 'formarter.php';
|
||||
|
||||
$endpoints = array(
|
||||
'apigate' => array('POST'),
|
||||
'generics' => array('POST')
|
||||
);
|
||||
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Expose-Headers: Access-Control-Allow-Origin");
|
||||
header("Access-Control-Allow-Headers: Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
|
||||
header("Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS");
|
||||
header('Content-type: application/json');
|
||||
|
||||
if ("OPTIONS" === $_SERVER['REQUEST_METHOD']) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$endpoint = strtolower(str_replace('/svs/user/', '', strtok($_SERVER['REQUEST_URI'], '?')));
|
||||
|
||||
$id = 0; // update, get & delete actions require ID
|
||||
if (substr($endpoint, 0, 19) == 'gettransportrequest' || substr($endpoint, 0, 13) == 'updateprofile') {
|
||||
$endpoint = strtok($endpoint, '/');
|
||||
$id = strtok('/');
|
||||
}
|
||||
|
||||
if (!isset($endpoints[$endpoint])) {
|
||||
header('HTTP/1.1 400 Bad Request');
|
||||
header('Status: 400 Bad Request');
|
||||
echo "{\"status\":\"Invalid endpoint url WRB\"}";
|
||||
exit();
|
||||
}
|
||||
|
||||
$methods = $endpoints[$endpoint];
|
||||
|
||||
if (array_search($_SERVER['REQUEST_METHOD'], $methods) === false) {
|
||||
header('HTTP/1.1 405 Method Not Allowed');
|
||||
header('Status: 405 Method Not Allowed');
|
||||
echo "{\"status\":\"Invalid request method\"}";
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$in = flatten(json_decode(file_get_contents('php://input'), true));
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "PUT") {
|
||||
parse_str(file_get_contents('php://input'), $in);
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "GET") {
|
||||
$in = $_GET;
|
||||
}
|
||||
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
||||
switch ($endpoint) {
|
||||
case 'generics':
|
||||
case 'apigate':
|
||||
//$in["action"] = WRENCHBOARD_ACCOUNT_LOGIN;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$in["pid"] = 100;
|
||||
$out = array();
|
||||
$ret = $wrenchboard->wrenchboard_api($in, $out);
|
||||
$out['internal_return'] = $ret; // this is reserved array parameter - to be caprured and reoved before you use the out array()
|
||||
|
||||
header("HTTP/1.1 200 OK");
|
||||
header("Status: 200 OK");
|
||||
//$out = array_merge($in, $out); // DEBUG
|
||||
echo json_encode(processOutJson($in, $out));
|
||||
exit();
|
||||
|
||||
function flatten($data, $parentkey = "") {
|
||||
$result = array();
|
||||
foreach ($data as $key => $val) {
|
||||
if (is_array($val)) {
|
||||
$result = array_merge($result, flatten($val, $parentkey . $key . "_"));
|
||||
} else {
|
||||
$result[$parentkey . $key] = $val;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
|
||||
RewriteEngine On
|
||||
RewriteBase /svs/bko/
|
||||
|
||||
#Checks to
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ bkove.php?endpoint=$1 [L,NC,QSA]
|
||||
|
||||
</IfModule>
|
||||
|
||||
<IfModule !mod_rewrite.c>
|
||||
# If we don't have mod_rewrite installed, all 404's
|
||||
# can be sent to index.php, and everything works as normal.
|
||||
# Submitted by: ElliotHaughin
|
||||
|
||||
ErrorDocument 404 /bkove.php
|
||||
|
||||
</IfModule>
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/*
|
||||
BACK OFFICE API GATEWAY
|
||||
*/
|
||||
include '../../backend.php';
|
||||
include '../constants.php';
|
||||
include '../formarter.php';
|
||||
|
||||
$endpoints = array(
|
||||
'generics' => array('POST')
|
||||
);
|
||||
|
||||
$call_backend = true; // sometimes we need to overwite the call to the extenstion API
|
||||
$local_out = []; // use local out to send output when the result is not from the extenstion
|
||||
$ret = -1;
|
||||
|
||||
//echo "Ameye 000 9";
|
||||
//exit();
|
||||
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Expose-Headers: Access-Control-Allow-Origin");
|
||||
header("Access-Control-Allow-Headers: Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
|
||||
header("Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS");
|
||||
header('Content-type: application/json');
|
||||
|
||||
if ("OPTIONS" === $_SERVER['REQUEST_METHOD']) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$endpoint = strtolower(str_replace('/svs/bko/', '', strtok($_SERVER['REQUEST_URI'], '?')));
|
||||
|
||||
$id = 0; // update, get & delete actions require ID
|
||||
if (substr($endpoint, 0, 19) == 'gettransportrequest' || substr($endpoint, 0, 13) == 'updateprofile') {
|
||||
$endpoint = strtok($endpoint, '/');
|
||||
$id = strtok('/');
|
||||
}
|
||||
|
||||
if (!isset($endpoints[$endpoint])) {
|
||||
header('HTTP/1.1 400 Bad Request');
|
||||
header('Status: 400 Bad Request');
|
||||
echo "{\"status\":\"Invalid endpoint url WRB\"}";
|
||||
exit();
|
||||
}
|
||||
|
||||
$methods = $endpoints[$endpoint];
|
||||
|
||||
if (array_search($_SERVER['REQUEST_METHOD'], $methods) === false) {
|
||||
header('HTTP/1.1 405 Method Not Allowed');
|
||||
header('Status: 405 Method Not Allowed');
|
||||
echo "{\"status\":\"Invalid request method\"}";
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$in = flatten(json_decode(file_get_contents('php://input'), true));
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "PUT") {
|
||||
parse_str(file_get_contents('php://input'), $in);
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "GET") {
|
||||
$in = $_GET;
|
||||
}
|
||||
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
||||
switch ($endpoint) {
|
||||
case 'generics':
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$in["pid"] = 100;
|
||||
|
||||
//file_put_contents("in_debug.log", $in); // DEBUG
|
||||
|
||||
$out = array();
|
||||
if ( $call_backend == true){
|
||||
$ret = $wrenchboard->wrenchboard_api($in, $out);
|
||||
$out['internal_return'] = $ret; // this is reserved array parameter - to be captured and received before you use the out array()
|
||||
}
|
||||
else
|
||||
{
|
||||
$out = $local_out;
|
||||
}
|
||||
|
||||
|
||||
header("HTTP/1.1 200 OK");
|
||||
header("Status: 200 OK");
|
||||
//$out = array_merge($in, $out); // DEBUG
|
||||
echo json_encode(processOutJson($in, $out));
|
||||
exit();
|
||||
|
||||
function flatten($data, $parentkey = "") {
|
||||
$result = array();
|
||||
foreach ($data as $key => $val) {
|
||||
if (is_array($val)) {
|
||||
$result = array_merge($result, flatten($val, $parentkey . $key . "_"));
|
||||
} else {
|
||||
$result[$parentkey . $key] = $val;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
// vi:ts=2
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$base_url = 'https://www.wrenchboard.com/svs/';
|
||||
$local_url = 'https://www.wrenchboard.com/svs/';
|
||||
?>
|
||||
@@ -0,0 +1,226 @@
|
||||
<?php
|
||||
require_once 'config.php';
|
||||
|
||||
|
||||
|
||||
define('PHP_API_OK', 0);
|
||||
define('PHP_LOGIN_OK', 100);
|
||||
define('PHP_CREATED_OK', 10);
|
||||
define('PHP_API_BAD_PARAM', -1);
|
||||
define('SESSION_TIMEOUT_LOGOUT',6000);
|
||||
|
||||
define('SUPPORT_PHONE','+234 (818)-3866434');
|
||||
|
||||
define('UPLOAD_FILE_SIZE',1);
|
||||
|
||||
define('OFFER_ACCEPT',100);
|
||||
define('OFFER_REJECT',333);
|
||||
define('OFFER_CANCEL',222);
|
||||
define('OFFER_EXPIRE',444);
|
||||
|
||||
define('JOB_INTEREST_ACCEPT',100);
|
||||
define('JOB_INTEREST_REJECT',200);
|
||||
define('JOB_INTEREST_CANCEL',300);
|
||||
|
||||
define('SMONEY_PROCC_MANUAL',100);
|
||||
define('SMONEY_PROCC_AUTO',200);
|
||||
define('SMONEY_PROCC_INTERSWITCH',300);
|
||||
|
||||
define('ACCOUNT_AGREE_JOBS',100);
|
||||
define('ACCOUNT_AGREE_REFER',200);
|
||||
|
||||
|
||||
define('WRENCHBOARD_SESSION_CHECK', 299);
|
||||
define('WRENCHBOARD_USER_LOGIN', 300);
|
||||
define('WRENCHBOARD_USER_LOGOUT', 301);
|
||||
define('WRENCHBOARD_CREATE_ACCOUNT', 320);
|
||||
|
||||
define('CONTRACT_CANCEL_CONTRACT', 7);
|
||||
define('CONTRACT_EXTEND_TIMELINE', 9);
|
||||
define('CONTRACT_NOTIFY_COMPLETE', 4);
|
||||
define('CONTRACT_REQUEST_CANCEL', 3);
|
||||
define('CONTRACT_ACCEPT_COMPLETE', 5);
|
||||
define('CONTRACT_REJECT_COMPLETE', 1);
|
||||
|
||||
|
||||
//**************************************************************
|
||||
define('WRENCHBOARD_BKO_START', 10000);
|
||||
|
||||
define('WRENCHBOARD_BKO_LOGIN', 10010);
|
||||
define('WRENCHBOARD_BKO_CREATEUSER', 10015);
|
||||
define('WRENCHBOARD_BKO_UPDATEUSER', 10020);
|
||||
|
||||
define('WRENCHBOARD_BKO_END', 10999);
|
||||
//**************************************************************
|
||||
define('WRENCHBOARD_ACCOUNT_START', 11000);
|
||||
|
||||
define('WRENCHBOARD_ACCOUNT_TESTEMAIL', 11001);
|
||||
define('WRENCHBOARD_ACCOUNT_PENDING', 11010);
|
||||
|
||||
define('WRENCHBOARD_CREATE_MOBILEUSER', 11011 );
|
||||
define('WRENCHBOARD_COMPLETE_MOBILEUSER', 11012 );
|
||||
|
||||
define('WRENCHBOARD_RESET_PASSWORD', 11013 );
|
||||
define('WRENCHBOARD_ACCOUNT_JOBLIST',11014 );
|
||||
|
||||
define('WRENCHBOARD_VERIFY_PENDING_LINK', 11015);
|
||||
define('WRENCHBOARD_ACCOUNT_RESETPASS', 11016);
|
||||
define('WRENCHBOARD_ACCOUNT_SETPASSWD', 11017);
|
||||
|
||||
define('WRENCHBOARD_DELETE_PENDING_LINK', 11018);
|
||||
define('WRENCHBOARD_RESEND_PENDING_LINK', 11019);
|
||||
|
||||
|
||||
define('WRENCHBOARD_ACCOUNT_CREATEACC', 11020);
|
||||
define('WRENCHBOARD_ACCOUNT_LOGIN', 11025);
|
||||
define('WRENCHBOARD_FACEBOOK_LOGIN', 11026);
|
||||
define('WRENCHBOARD_START_JOBLIST', 11028);
|
||||
define('WRENCHBOARD_ACCOUNT_DASHDATA', 11029);
|
||||
|
||||
define('WRENCHBOARD_SEND_CONTACTUS', 11030);
|
||||
define('WRENCHBOARD_ACCOUNT_SENDREFER',11032);
|
||||
define('WRENCHBOARD_ACCOUNT_REFERLINK',11033);
|
||||
define('WRENCHBOARD_SESSION_VERIFY', 11034);
|
||||
define('WRENCHBOARD_UPDATE_PROFILE',11035);
|
||||
define('WRENCHBOARD_ACCOUNT_TERMS',11036);
|
||||
define('WRENCHBOARD_ACCOUNT_MDESCRIPTION',11037);
|
||||
define('WRENCHBOARD_ACCOUNT_SAVESKILL', 11038);
|
||||
define('WRENCHBOARD_ACCOUNT_DELSKILL', 11039);
|
||||
define('WRENCHBOARD_LOG_MEMBER', 11040);
|
||||
|
||||
define('WRENCHBOARD_DELETE_RECACC', 11041);
|
||||
define('WRENCHBOARD_SAVE_GALLERY', 11042);
|
||||
|
||||
define('WRENCHBOARD_ACCOUNT_PENDJOB', 11043 );
|
||||
|
||||
|
||||
define('WRENCHBOARD_USER_GETBANKLIST', 11050);
|
||||
define('WRENCHBOARD_USER_SENDMONEY', 11051);
|
||||
define('WRENCHBOARD_USER_SENDJOBINT', 11052);
|
||||
|
||||
define('WRENCHBOARD_ACCOUNT_WALLETS', 11060);
|
||||
|
||||
|
||||
define('WRENCHBOARD_ACCOUNT_END', 11999);
|
||||
//**************************************************************
|
||||
define('WRENCHBOARD_JOB_CREATEJOB',13010 );
|
||||
define('WRENCHBOARD_JOB_DELETEJOB',13011 );
|
||||
|
||||
define('WRENCHBOARD_JOB_GROUP_MEMBER', 13015) ;
|
||||
define('WRENCHBOARD_JOB_DELETE_GROUPMEMBER',13017);
|
||||
define('WRENCHBOARD_JOB_CREATE_GROUP', 13020);
|
||||
define('WRENCHBOARD_JOB_DELETE_GROUP',13023);
|
||||
|
||||
define('WRENCHBOARD_JOB_OFFER_INDVI',13030);
|
||||
define('WRENCHBOARD_JOB_OFFER_GROUP',13031);
|
||||
define('WRENCHBOARD_JOB_OFFER_PUBLIC',13032);
|
||||
define('WRENCHBOARD_JOB_SEND_INTEREST',13033);
|
||||
define('WRENCHBOARD_JOB_PROC_INTEREST',13034);
|
||||
define('WRENCHBOARD_JOB_OFFER_CONCLUDE',13035);
|
||||
define('WRENCHBOARD_JOB_SEND_QUESTION',13036);
|
||||
define('WRENCHBOARD_JOB_MRKTINT_QUEST',13037);
|
||||
define('WRENCHBOARD_JOB_REPLY_QUESTION',13038);
|
||||
|
||||
|
||||
define('WRENCHBOARD_GROUP_START', 12000);
|
||||
|
||||
|
||||
define('WRENCHBOARD_GROUP_CREATEGROUP', 12010);
|
||||
define('WRENCHBOARD_GROUP_INVITEGROUP', 12015);
|
||||
define('WRENCHBOARD_GROUP_ACCEPTGROUP', 12020);
|
||||
|
||||
define('WRENCHBOARD_GROUP_END', 12999);
|
||||
//**************************************************************
|
||||
|
||||
define('WRENCHBOARD_CONTRACT_MESSAGE', 14010);
|
||||
define('WRENCHBOARD_CONTRACT_STATUS', 14015);
|
||||
|
||||
|
||||
define('WRENCHBOARD_MOBILE_OFFERSLIST', 15010);
|
||||
define('WRENCHBOARD_MOBILE_ACTIVEJOB', 15020);
|
||||
define('WRENCHBOARD_MOBILE_LOADPROFILE', 15030);
|
||||
define('WRENCHBOARD_MOBILE_ACCOUNT', 15040);
|
||||
define('WRENCHBOARD_MOBILE_MESSAGE', 15045);
|
||||
define('WRENCHBOARD_MOBILE_PAYMENTHX', 15046);
|
||||
define('WRENCHBOARD_MOBILE_TASKMESSAGE', 15047);
|
||||
define('WRENCHBOARD_MOBILE_SENDTASKMESSAGE', 15048);
|
||||
|
||||
|
||||
|
||||
|
||||
define('WRENCHBOARD_SMONEY_ADDRECIPIENT', 33010);
|
||||
define('WRENCHBOARD_SMONEY_MEMBER', 33020);
|
||||
define('WRENCHBOARD_SMONEY_PROCFEE', 33025);
|
||||
|
||||
define('WRENCHBOARD_SMONEY_BKOPROC', 33030 );
|
||||
|
||||
|
||||
define('WRENCHBOARD_LOGIN_SHOP', 50501);
|
||||
define('WRENCHBOARD_LOGIN_ADMIN', 50502);
|
||||
define('WRENCHBOARD_LOGIN_MANAGER', 50503);
|
||||
|
||||
define('WRENCHBOARD_SURVEY_DATA', 55000);
|
||||
define('WRENCHBOARD_ADD_SURVEY', 55050);
|
||||
define('WRENCHBOARD_LOAD_SURVEY', 55055);
|
||||
|
||||
|
||||
define('WRENCHBOARD_COMPLETE_SENDMONEY_INTERSW', 555);
|
||||
define('WRENCHBOARD_GETBILLER_INTERSW', 556);
|
||||
define('WRENCHBOARD_BILL_PAYMENT_ADVICE_INTERSW', 557);
|
||||
|
||||
define('WRENCHBOARD_INTERSW_GETBILLER', 556);
|
||||
define('WRENCHBOARD_INTERSW_BILL_PAYMENT_ADVICE', 557);
|
||||
define('WRENCHBOARD_INTERSW_GETBILLERPAYMENTINTEMS', 558);
|
||||
define('WRENCHBOARD_INTERSW_GETBILLERCATEGORIES', 559);
|
||||
define('WRENCHBOARD_INTERSW_DO_TRANSFER', 560);
|
||||
define('WRENCHBOARD_INTERSW_QUERY_TRANSACTION', 561);
|
||||
|
||||
define('WRENCHBOARD_ADD_MONEYRECIPIENT', 600);
|
||||
|
||||
define('WRENCHBOARD_CREATE_USER_ACCOUNT', 700);
|
||||
define('WRENCHBOARD_USER_ACCOUNT_LOGIN', 710);
|
||||
define('WRENCHBOARD_START_PASSWORDRESET', 720);
|
||||
define('WRENCHBOARD_COMPLETE_PASSWORDRESET', 730);
|
||||
|
||||
//#define WRENCHBOARD_START_ADDMONEY', 770 );
|
||||
//#define WRENCHBOARD_COMPLETE_ADDMONEY' 775 );
|
||||
|
||||
define('WRENCHBOARD_CARDS_GETCARDLIST', 40010);
|
||||
define('WRENCHBOARD_CARDS_UPDATECARD', 40015) ;
|
||||
|
||||
define('WRENCHBOARD_COUPON_REDEEM', 85020);
|
||||
define('WRENCHBOARD_COUPON_MEMLIST', 85025);
|
||||
define('WRENCHBOARD_COUPON_PENDLIST', 85030);
|
||||
|
||||
|
||||
define('WRENCHBOARD_ADD_MOBILE_TOPUPNUM', 900);
|
||||
define('WRENCHBOARD_PROMO_CALL', 990);
|
||||
|
||||
|
||||
define('WRENCHBOARD_STOREFACE_GET_ACCOUNT_BALANCE', 891);
|
||||
|
||||
define('WRENCHBOARD_LOG_ENTRY', 900000);
|
||||
define('WRENCHBOARD_CREDIT_TOPUP', 900010);
|
||||
|
||||
define('WRENCHBOARD_TOPUP_ORDER', 900020);
|
||||
define('WRENCHBOARD_TOPUP_ORDER_PURCHASE', 900030);
|
||||
define('WRENCHBOARD_PAYPAL_IPNMSG', 900090);
|
||||
|
||||
define('WRENCHBOARD_BULKTOPUP_ORDER', 700010);
|
||||
define('WRENCHBOARD_BULKTOPUP_ITEM', 700020);
|
||||
define('WRENCHBOARD_BULKTOPUP_ITEMUPDATE', 700030);
|
||||
define('WRENCHBOARD_BULKTOPUP_DELIVER', 700040);
|
||||
|
||||
define('WRENCHBOARD_BALANCE_TOPUP_ORDER', 800020);
|
||||
define('WRENCHBOARD_BALANCE_TOPUP_PURCHASE', 800030);
|
||||
define('WRENCHBOARD_BALANCE_TOPUP_PAYMENT', 800040);
|
||||
|
||||
define('VIRTUAL_AIRTOPUP', 70011);
|
||||
define('PAY_MODE_BALANCE', 0);
|
||||
define('PAY_MODE_CCARD', 1);
|
||||
define('PAY_MODE_BONUS', 9);
|
||||
define('APPROVED_BALANCE', 5);
|
||||
define('DISAPROVE_BALANCE', 3);
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
<?php
|
||||
|
||||
function formatCreateTranspData($in) {
|
||||
$in["member_id"] = $in["session_member_id"];
|
||||
$in['firstname'] = $in['patientinfo_firstname'];
|
||||
$in['lastname'] = $in['patientinfo_lastname'];
|
||||
$in['from_phone'] = $in['patientinfo_phone']; //
|
||||
|
||||
$in['from_street'] = $in['pickupaddress_streetaddress']; //
|
||||
//$in['from_aptno'] = $in['pickupaddress_aptno']; //
|
||||
$in['from_zipcode'] = $in['pickupaddress_zip']; //
|
||||
|
||||
$in['from_city'] = $in['pickupaddress_city']; //
|
||||
$in['from_state'] = $in['pickupaddress_state']; //
|
||||
$in['to_street'] = $in['dropoffaddress_streetaddress']; //
|
||||
//$in['to_aptno'] = $in['dropoffaddress_aptno']; //
|
||||
$in['to_zipcode'] = $in['dropoffaddress_zip']; //
|
||||
$in['to_city'] = $in['dropoffaddress_city']; //
|
||||
$in['to_state'] = $in['dropoffaddress_state']; //
|
||||
$in['facilityname'] = $in['dropoffaddress_facilityname']; //
|
||||
$in['transport_date'] = $in['datetime_currentdate'] . " " . $in['datetime_currentTime'];
|
||||
|
||||
// payment information
|
||||
$in['paymenttype'] = $in['paymentinfo_paymenttype']; //
|
||||
$in['paymentid'] = $in['paymentinfo_paymentid']; //
|
||||
$in['cardname'] = $in['paymentinfo_fullname']; //
|
||||
$in['cardnumber'] = $in['paymentinfo_cardnumber']; //
|
||||
$in['exp_month'] = $in['paymentinfo_exp_month']; //
|
||||
$in['exp_year'] = $in['paymentinfo_exp_year']; //
|
||||
$in['cvc'] = $in['paymentinfo_cvc']; //
|
||||
|
||||
|
||||
return $in;
|
||||
}
|
||||
|
||||
function processOutJson($in, $out) {
|
||||
if ($in["action"] != MEDTRANS_USER_GET_TRANSLIST) {
|
||||
// return $out;
|
||||
}
|
||||
|
||||
// id AS coupon_id, ca.code, ca.amount, ca.added::date,ca.status
|
||||
switch ($in["action"]) {
|
||||
case WRENCHBOARD_CARDS_GETCARDLIST:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"assign_id" => $out["assign_id_${key}"],
|
||||
"title" => $out["title_${key}"],
|
||||
"description" => $out["description_${key}"],
|
||||
"card_type" => $out["card_type_${key}"],
|
||||
"card_style" => $out["card_style_${key}"],
|
||||
"card_icon" => $out["card_icon_${key}"] );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_COUPON_MEMLIST:
|
||||
case WRENCHBOARD_COUPON_PENDLIST:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"coupon_id" => $out["coupon_id_${key}"],
|
||||
"code" => $out["code_${key}"],
|
||||
"amount" => $out["amount_${key}"],
|
||||
"added" => $out["added_${key}"],
|
||||
"status" => $out["status_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_MOBILE_TASKMESSAGE:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"title" => $out["title_${key}"],
|
||||
"msg" => $out["msg_${key}"],
|
||||
"msg_id" => $out["msg_id_${key}"],
|
||||
"date" => $out["date_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_START_JOBLIST:
|
||||
case WRENCHBOARD_ACCOUNT_JOBLIST:
|
||||
case WRENCHBOARD_ACCOUNT_PENDJOB:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"title" => $out["title_${key}"],
|
||||
"description" => $out["description_${key}"],
|
||||
"id" => $out["id_${key}"],
|
||||
"job_description" => $out["job_description_${key}"],
|
||||
"price" => $out["price_${key}"],
|
||||
"timeline_days" => $out["timeline_days_${key}"],
|
||||
"expire" => $out["expire_${key}"],
|
||||
"sent" => $out["sent_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
case WRENCHBOARD_MOBILE_ACTIVEJOB:
|
||||
case WRENCHBOARD_MOBILE_OFFERSLIST:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"title" => $out["title_${key}"],
|
||||
"description" => $out["description_${key}"],
|
||||
"id" => $out["id_${key}"],
|
||||
"job_description" => $out["job_description_${key}"],
|
||||
"price" => $out["price_${key}"],
|
||||
"timeline_days" => $out["timeline_days_${key}"],
|
||||
|
||||
"contract_id" => $out["contract_id_${key}"],
|
||||
"job_id" => $out["job_id_${key}"],
|
||||
"contract" => $out["contract_${key}"],
|
||||
"status_description" => $out["status_description_${key}"],
|
||||
|
||||
"delivery_date" => $out["delivery_date_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
case WRENCHBOARD_MOBILE_MESSAGE:
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"msg" => $out["msg_${key}"],
|
||||
"msg_id" => $out["msg_id_${key}"],
|
||||
"msg_date" => $out["msg_date_${key}"],
|
||||
"msg_from" => $out["msg_from_${key}"]
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_MOBILE_PAYMENTHX:
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"fee" => $out["fee_${key}"],
|
||||
"amount" => $out["amount_${key}"],
|
||||
"recipient" => $out["recipient_${key}"],
|
||||
"confirmation" => $out["confirmation_${key}"],
|
||||
"status" => $out["status_${key}"],
|
||||
"trx_date" => $out["trx_date_${key}"],
|
||||
"trx_id" => $out["trx_id_${key}"]
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_USER_GETBANKLIST:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"recipient" => $out["recipient_${key}"],
|
||||
"account_no" => $out["account_no_${key}"],
|
||||
"bank_id" => $out["bank_id_${key}"],
|
||||
"added" => $out["added_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_ACCOUNT_WALLETS:
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"currency" => $out["currency_${key}"],
|
||||
"amount" => $out["amount_${key}"],
|
||||
"symbol" => $out["symbol_${key}"],
|
||||
"description" => $out["description_${key}"],
|
||||
"action_type" => $out["action_type_${key}"],
|
||||
"code" => $out["code_${key}"]
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return $out;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
function getBlogData(){
|
||||
return [
|
||||
[
|
||||
'meta_value' => "https://blog.wrenchboard.com/wp-content/uploads/2022/01/universitty.jpg",
|
||||
'post_date' => "2018-06-25T18:54:22.000Z",
|
||||
'post_date_gmt' => "2018-06-25T18:54:22.000Z",
|
||||
'post_content' => "Globalization spells danger for the type of jobs that will be available at graduation. The nature of jobs changes so often that it could frustrate for the students. The changes also present new opportunities. Globalization also ensures that job can come anonymously from any part of the world and transaction can be completed privately.\n\nThis is where <a href=\"https://www.wrenchboard.com\">WrenchBoard </a>comes in, rather than focus on your primary education as your source of income, the new economy will look at your skills as this guide. Your question is to self-examine and attributes values to what you have that others need to make their own or goal complete.\n\nUniversity students can earn extra income along with their regular educational and school work by taking part-time tasks online. To get a project up and running there are a lot of components of service that every business goes through and there are those tasks that students can attend to. Students are in best position to do an initial critique of sites, write articles that bear innocence or interest meddling or test an app for a company in beta phase.\n\nThe online nature of the jobs gives the student the necessary flexibility to operate and added the benefit of interacting with people that don’t think like them, it is an opportunity for the larger world. It is getting very hard to manufacture excuses for not to be involved with one online job or the other when the opportunities and the capabilities collide. A student should be made aware of the fact that life is going to get busier once the excuse of the school is removed.\n\nThere are many jobs students can easily do online\n<ul>\n \t<li>\tOnline marketing - most students have Facebooks and other social environments with tons of friends or connection. Somebody on this planet needs that profile or demography and will be will to pay for it if there is a way to do so</li>\n \t<li>\nTeaching - being a student also has the benefit of living in environment where you play with commercial tools, somebody have question about those tools you are playing with that they are willing to pay for - for example, student work with expensive robots in labs and an industrial hand may have questions that you can check out in your experiment environment</li>\n \t<li>\nWriting Articles/Blogging -</li>\n \t<li>\nSurveys/Research</li>\n \t<li>Campaigns</li>\n</ul>",
|
||||
'post_title' => "Online Jobs for University Students",
|
||||
],
|
||||
[
|
||||
'meta_value' => "https://blog.wrenchboard.com/wp-content/uploads/2022/01/time_manageent.jpg",
|
||||
'post_date' => "2017-11-23T14:05:51.000Z",
|
||||
'post_date_gmt' => "2017-11-23T14:05:51.000Z",
|
||||
'post_content' => "There are different types of online jobs and some pay more money than others do while some typing jobs may need special equipment, education, or training in order to do them. The advantage of an online job is that you can work at any time of the day around your personal schedule. You can even work in the evening or at night.\n\nYour income from an online job will also depend on the kind of job you do, your experience and your skills.\n\n<strong>Price management</strong>\n\nFirstly, you will need to establish the services you will offer your clients and a business essentially succeeds by filling a void or a niche in the market.\n\nEnsure you are familiar with the different online jobs out there as each job category pays differently. The categories of online jobs include Copywriting, SEO copywriting, Content writing, Proofreading, editing, freelance writing, social media marketing and professional blogging. You do not have to work in one field only; you can work in various fields. Research on how much each field pays; this is so you do not sell yourself short and earn less money than you should be earning.\n\nAlways do your best work for every project as the quality of your work will speak for you and you can gauge your prices better while establishing your reputation.\n\nNetworking is also essential both online and in person. You can use social media platforms like LinkedIn to network online. The more you work towards being noticed, the more clients and projects you will get.\n\n<strong>Time management </strong>\n\nWorking an online business means, you will be working from home in most cases and time management is an essential part of working online. Here are a few tips to help you manage your time better with an online job.\n<ul>\n \t<li>Remove all the extra tabs from your web browser, as they can be reminders of the fact that the internet is a vast wormhole of your attention. Open fewer tabs if you want to have a more productive workday.</li>\n \t<li>Remove papers from your desktop as a ton of paperwork on your desktop could discourage you from remaining focused. Ensure you clear your desktop after each workday.</li>\n \t<li>Avoid social media interruptions as social media can hinder your productivity if you do not practice mindfulness. You can set up a specific time to socialize before your workday begins or just before retiring after your workday.</li>\n \t<li>Block any needless distractions because at times pure silence might be all you need to do to enhance your production. Turn your radio, television, or telephone off. Avoid visiting any social media platforms, ignore email notifications, and even close your browser.</li>\n \t<li>Select the best time for you to work; you may find that you are more productive during certain hours of the day. Find out what your optimal time frame is and work during said hours so that you get more work done. Most importantly, ensure you follow your schedule strictly.</li>\n</ul>\n ",
|
||||
'post_title' => "Time and price management when working an online job",
|
||||
],
|
||||
[
|
||||
'meta_value' => "https://blog.wrenchboard.com/wp-content/uploads/2022/01/man_reading.jpg",
|
||||
'post_date' => "2017-11-23T14:04:49.000Z",
|
||||
'post_date_gmt' => "2017-11-23T14:04:49.000Z",
|
||||
'post_content' => "Content syndication involves methods of content republication on other websites so you can reach a wider audience. Syndication of your content is a great way to enhance your brand awareness and your reach, direct traffic to your article, and build links. The internet is vast and it is not reasonable to assume that everyone you want to reach will read your content simply because you published it on your own site. Syndicating your content gets it to a different audience who might have never known it was there in the first place. Content syndication is a good and cheap way to further your content. It is a content marketing strategy. There are 4 kinds of content syndication you should know of:\n<ol>\n \t<li><strong>Syndicating content (3rd party) on your website </strong></li>\n</ol>\nPublishers can ask different websites for permission to display their content on your website or blog. Your site should have roughly 10% syndicated content ideally. Even though it might be unoriginal, it is always good to feature useful content that your readers will find beneficial and worth reading. It is difficult to find great authors committed to writing content for you when you run a website or blog with multiple authors. Ask an influencer on whether you can feature their existing content as a reasonable resolution. Syndicated content diversifies your site content instantly by highlighting something valuable and new to your target audience.\n<ol start=\"2\">\n \t<li><strong>Syndicating your content on other blogs or websites</strong></li>\n</ol>\nPublishers can syndicate their content to be displayed on another partner website or sites. You can either create content that is not original for your partner who will just be republishing your content. Alternatively, you can agree on a split which both sides find acceptable i.e. you can give them syndicated content for one month and produce original content the next month. If the agreement calls for 1-4 posts monthly, one of them must at least be original.\n<ol start=\"3\">\n \t<li><strong>Publish your content on websites syndicating their content</strong></li>\n</ol>\nAnother way to syndicate your content is by contributing regularly to websites already syndicating their content. Think of it this way, if you are publishing your content for a specific website on a regular basis and they are content syndicators, their content would also end up on other significant partner websites.\n<ol start=\"4\">\n \t<li><strong>Self-service syndication</strong></li>\n</ol>\nPublishers are also able to syndicate their own content with Medium as a great place to start with this endeavor. Medium allows you to import your already existing content from the internet edit, format, and publishing it. It allows you to run your own publications using minimal effort. LinkedIn is another platform you can use to republish your own website content so it reaches a bigger audience.\n\nYou have tools available at your disposal that can help you get your content to a wider target audience while enhancing traffic to your website, establishing a stronger following, and developing your reputation.",
|
||||
'post_title' => "How to use syndication techniques to promote your articles online",
|
||||
],
|
||||
[
|
||||
'meta_value' => "https://blog.wrenchboard.com/wp-content/uploads/2022/01/wrechboard-sample.jpg",
|
||||
'post_date' => "2017-11-23T14:03:39.000Z",
|
||||
'post_date_gmt' => "2017-11-23T14:03:39.000Z",
|
||||
'post_content' => "<strong>Paying mind to similarity index and why ignoring it could have serious repercussions </strong>\n\nThe similarity index is a term you should be familiar with as an online writer. It is defined as the composite number that is highlighted after matching two texts to determine how similar the content from both pieces is. It is typically displayed as a percentage and the displayed number measures the percentage of your article that the program found the matching text for. This is regardless of proper citation in your work or lack thereof.\n\nIf the similarity index is high this could mean the writer has quoted various other works to a large extent even if it is legitimate.\n\nIt is understandable that you will want to offer quality content for search engines in terms of consideration and indexation and this can lead you to weed your indexable content down. You may also be worried that search engines will not be able to comprehend your content due to existing similar pages because of things like product variations. It will be unwise for you to rush into a decision that could damage your SEO in the process of trying to make search engines happy while destroying your organic visibility in the process.\n\nYou can make use of canonical tags to instruct crawling search engines of the representative alternatives of similar or duplicate content. You just have to place these tags within your source code head section. Canonical tags are very effective in dealing with similar or duplicate content. The easiest way to determine whether you have similar content on your website is to review the site manually while addressing sections of the site appearing to have different URLs but similar content. Take some of the URLs and use tools such as Similar Page Checker or simply review the site for any similar content using Siteliner.\n\nYou may also want to consider consolidating multiple pages into one or expanding certain pages if you have multiple pages that appear to be similar. For example, if you have a site with two distinct pages for different but related topics but the information is the same on both these pages, you may either expand each page further to encompass original content about each topic or merge both pages into one about both topics.\n\nSimilar content can present an issue if not addressed:\n\nYour website will suffer in terms of ranking and you may end up losing traffic. Both losses typically originate from 2 main issues\n\n- Search engines rarely show multiple options of similar content in order to give users an optimum search experience. They will, therefore, be forced to select the best version which will be shown as the best result diluting visibility of websites with similar or duplicate content.\n\n- Equity of links will also be diluted further because other websites will have to choose the best option from the duplicates. As opposed to all the inbound links directing to one content piece, they will link to several pieces distributing the equity of the links among these duplicates. Inbound links are considered a ranking factor so they can affect the search visibility of certain pieces of content.\n\nThe overall result is that the piece of content will not get the search visibility it deserves.\n\n ",
|
||||
'post_title' => "Paying mind to similarity index",
|
||||
]
|
||||
];
|
||||
//return $blogData;
|
||||
}
|
||||
|
||||
function getBlogItem(){
|
||||
return [
|
||||
[
|
||||
'meta_value' => "https://blog.wrenchboard.com/wp-content/uploads/2022/01/universitty.jpg",
|
||||
'post_date' => "2018-06-25T18:54:22.000Z",
|
||||
'post_date_gmt' => "2018-06-25T18:54:22.000Z",
|
||||
'post_content' => "Globalization spells danger for the type of jobs that will be available at graduation. The nature of jobs changes so often that it could frustrate for the students. The changes also present new opportunities. Globalization also ensures that job can come anonymously from any part of the world and transaction can be completed privately.\n\nThis is where <a href=\"https://www.wrenchboard.com\">WrenchBoard </a>comes in, rather than focus on your primary education as your source of income, the new economy will look at your skills as this guide. Your question is to self-examine and attributes values to what you have that others need to make their own or goal complete.\n\nUniversity students can earn extra income along with their regular educational and school work by taking part-time tasks online. To get a project up and running there are a lot of components of service that every business goes through and there are those tasks that students can attend to. Students are in best position to do an initial critique of sites, write articles that bear innocence or interest meddling or test an app for a company in beta phase.\n\nThe online nature of the jobs gives the student the necessary flexibility to operate and added the benefit of interacting with people that don’t think like them, it is an opportunity for the larger world. It is getting very hard to manufacture excuses for not to be involved with one online job or the other when the opportunities and the capabilities collide. A student should be made aware of the fact that life is going to get busier once the excuse of the school is removed.\n\nThere are many jobs students can easily do online\n<ul>\n \t<li>\tOnline marketing - most students have Facebooks and other social environments with tons of friends or connection. Somebody on this planet needs that profile or demography and will be will to pay for it if there is a way to do so</li>\n \t<li>\nTeaching - being a student also has the benefit of living in environment where you play with commercial tools, somebody have question about those tools you are playing with that they are willing to pay for - for example, student work with expensive robots in labs and an industrial hand may have questions that you can check out in your experiment environment</li>\n \t<li>\nWriting Articles/Blogging -</li>\n \t<li>\nSurveys/Research</li>\n \t<li>Campaigns</li>\n</ul>",
|
||||
'post_title' => "Online Jobs for University Students ITEM",
|
||||
]
|
||||
];
|
||||
//return $blogData;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
|
||||
RewriteEngine On
|
||||
RewriteBase /svs/user/
|
||||
#RewriteBase /
|
||||
|
||||
#Checks to
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ userve.php?endpoint=$1 [L,NC,QSA]
|
||||
|
||||
</IfModule>
|
||||
|
||||
<IfModule !mod_rewrite.c>
|
||||
# If we don't have mod_rewrite installed, all 404's
|
||||
# can be sent to index.php, and everything works as normal.
|
||||
# Submitted by: ElliotHaughin
|
||||
|
||||
ErrorDocument 404 /userve.php
|
||||
|
||||
</IfModule>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
//$base_url = 'https://fluxtra:fl0xtra!@oameye.works.wrenchboard.com/svs/';
|
||||
//$local_url = 'https://fluxtra:fl0xtra!@oameye.works.wrenchboard.com/svs/';
|
||||
$base_url = 'https://www.wrenchboard.com/svs/user/';
|
||||
$local_url = 'https://www.wrenchboard.com/svs/user/';
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
require_once 'config.php';
|
||||
|
||||
|
||||
|
||||
define('PHP_API_OK', 0);
|
||||
define('PHP_LOGIN_OK', 100);
|
||||
define('PHP_CREATED_OK', 10);
|
||||
define('PHP_API_BAD_PARAM', -1);
|
||||
define('SESSION_TIMEOUT_LOGOUT',6000);
|
||||
|
||||
define('SUPPORT_PHONE','+234 (818)-3866434');
|
||||
|
||||
define('UPLOAD_FILE_SIZE',1);
|
||||
|
||||
define('OFFER_ACCEPT',100);
|
||||
define('OFFER_REJECT',333);
|
||||
define('OFFER_CANCEL',222);
|
||||
define('OFFER_EXPIRE',444);
|
||||
|
||||
define('JOB_INTEREST_ACCEPT',100);
|
||||
define('JOB_INTEREST_REJECT',200);
|
||||
define('JOB_INTEREST_CANCEL',300);
|
||||
|
||||
define('SMONEY_PROCC_MANUAL',100);
|
||||
define('SMONEY_PROCC_AUTO',200);
|
||||
define('SMONEY_PROCC_INTERSWITCH',300);
|
||||
|
||||
define('ACCOUNT_AGREE_JOBS',100);
|
||||
define('ACCOUNT_AGREE_REFER',200);
|
||||
|
||||
|
||||
define('WRENCHBOARD_SESSION_CHECK', 299);
|
||||
define('WRENCHBOARD_USER_LOGIN', 300);
|
||||
define('WRENCHBOARD_USER_LOGOUT', 301);
|
||||
define('WRENCHBOARD_CREATE_ACCOUNT', 320);
|
||||
|
||||
define('CONTRACT_CANCEL_CONTRACT', 7);
|
||||
define('CONTRACT_EXTEND_TIMELINE', 9);
|
||||
define('CONTRACT_NOTIFY_COMPLETE', 4);
|
||||
define('CONTRACT_REQUEST_CANCEL', 3);
|
||||
define('CONTRACT_ACCEPT_COMPLETE', 5);
|
||||
define('CONTRACT_REJECT_COMPLETE', 1);
|
||||
|
||||
|
||||
//**************************************************************
|
||||
define('WRENCHBOARD_BKO_START', 10000);
|
||||
|
||||
define('WRENCHBOARD_BKO_LOGIN', 10010);
|
||||
define('WRENCHBOARD_BKO_CREATEUSER', 10015);
|
||||
define('WRENCHBOARD_BKO_UPDATEUSER', 10020);
|
||||
|
||||
define('WRENCHBOARD_BKO_END', 10999);
|
||||
//**************************************************************
|
||||
define('WRENCHBOARD_ACCOUNT_START', 11000);
|
||||
|
||||
define('WRENCHBOARD_ACCOUNT_TESTEMAIL', 11001);
|
||||
define('WRENCHBOARD_ACCOUNT_PENDING', 11010);
|
||||
define('WRENCHBOARD_VERIFY_PENDING_LINK', 11015);
|
||||
define('WRENCHBOARD_ACCOUNT_RESETPASS', 11016);
|
||||
define('WRENCHBOARD_ACCOUNT_SETPASSWD', 11017);
|
||||
|
||||
define('WRENCHBOARD_DELETE_PENDING_LINK', 11018);
|
||||
define('WRENCHBOARD_RESEND_PENDING_LINK', 11019);
|
||||
|
||||
|
||||
define('WRENCHBOARD_ACCOUNT_CREATEACC', 11020);
|
||||
define('WRENCHBOARD_ACCOUNT_LOGIN', 11025);
|
||||
define('WRENCHBOARD_FACEBOOK_LOGIN', 11026);
|
||||
define('WRENCHBOARD_START_JOBLIST', 11028);
|
||||
|
||||
define('WRENCHBOARD_SEND_CONTACTUS', 11030);
|
||||
define('WRENCHBOARD_ACCOUNT_SENDREFER',11032);
|
||||
define('WRENCHBOARD_ACCOUNT_REFERLINK',11033);
|
||||
define('WRENCHBOARD_SESSION_VERIFY', 11034);
|
||||
define('WRENCHBOARD_UPDATE_PROFILE',11035);
|
||||
define('WRENCHBOARD_ACCOUNT_TERMS',11036);
|
||||
define('WRENCHBOARD_ACCOUNT_MDESCRIPTION',11037);
|
||||
define('WRENCHBOARD_ACCOUNT_SAVESKILL', 11038);
|
||||
define('WRENCHBOARD_ACCOUNT_DELSKILL', 11039);
|
||||
define('WRENCHBOARD_LOG_MEMBER', 11040);
|
||||
|
||||
define('WRENCHBOARD_DELETE_RECACC', 11041);
|
||||
define('WRENCHBOARD_SAVE_GALLERY', 11042);
|
||||
|
||||
define('WRENCHBOARD_ACCOUNT_END', 11999);
|
||||
//**************************************************************
|
||||
define('WRENCHBOARD_JOB_CREATEJOB',13010 );
|
||||
define('WRENCHBOARD_JOB_DELETEJOB',13011 );
|
||||
|
||||
define('WRENCHBOARD_JOB_GROUP_MEMBER', 13015) ;
|
||||
define('WRENCHBOARD_JOB_DELETE_GROUPMEMBER',13017);
|
||||
define('WRENCHBOARD_JOB_CREATE_GROUP', 13020);
|
||||
define('WRENCHBOARD_JOB_DELETE_GROUP',13023);
|
||||
|
||||
define('WRENCHBOARD_JOB_OFFER_INDVI',13030);
|
||||
define('WRENCHBOARD_JOB_OFFER_GROUP',13031);
|
||||
define('WRENCHBOARD_JOB_OFFER_PUBLIC',13032);
|
||||
define('WRENCHBOARD_JOB_SEND_INTEREST',13033);
|
||||
define('WRENCHBOARD_JOB_PROC_INTEREST',13034);
|
||||
define('WRENCHBOARD_JOB_OFFER_CONCLUDE',13035);
|
||||
define('WRENCHBOARD_JOB_SEND_QUESTION',13036);
|
||||
define('WRENCHBOARD_JOB_MRKTINT_QUEST',13037);
|
||||
define('WRENCHBOARD_JOB_REPLY_QUESTION',13038);
|
||||
|
||||
|
||||
define('WRENCHBOARD_GROUP_START', 12000);
|
||||
|
||||
|
||||
define('WRENCHBOARD_GROUP_CREATEGROUP', 12010);
|
||||
define('WRENCHBOARD_GROUP_INVITEGROUP', 12015);
|
||||
define('WRENCHBOARD_GROUP_ACCEPTGROUP', 12020);
|
||||
|
||||
define('WRENCHBOARD_GROUP_END', 12999);
|
||||
//**************************************************************
|
||||
|
||||
define('WRENCHBOARD_CONTRACT_MESSAGE', 14010);
|
||||
define('WRENCHBOARD_CONTRACT_STATUS', 14015);
|
||||
|
||||
define('WRENCHBOARD_SMONEY_ADDRECIPIENT', 33010);
|
||||
define('WRENCHBOARD_SMONEY_MEMBER', 33020);
|
||||
define('WRENCHBOARD_SMONEY_PROCFEE', 33025);
|
||||
|
||||
define('WRENCHBOARD_SMONEY_BKOPROC', 33030 );
|
||||
|
||||
|
||||
define('WRENCHBOARD_LOGIN_SHOP', 50501);
|
||||
define('WRENCHBOARD_LOGIN_ADMIN', 50502);
|
||||
define('WRENCHBOARD_LOGIN_MANAGER', 50503);
|
||||
|
||||
define('WRENCHBOARD_SURVEY_DATA', 55000);
|
||||
define('WRENCHBOARD_ADD_SURVEY', 55050);
|
||||
define('WRENCHBOARD_LOAD_SURVEY', 55055);
|
||||
|
||||
|
||||
define('WRENCHBOARD_COMPLETE_SENDMONEY_INTERSW', 555);
|
||||
define('WRENCHBOARD_GETBILLER_INTERSW', 556);
|
||||
define('WRENCHBOARD_BILL_PAYMENT_ADVICE_INTERSW', 557);
|
||||
|
||||
define('WRENCHBOARD_INTERSW_GETBILLER', 556);
|
||||
define('WRENCHBOARD_INTERSW_BILL_PAYMENT_ADVICE', 557);
|
||||
define('WRENCHBOARD_INTERSW_GETBILLERPAYMENTINTEMS', 558);
|
||||
define('WRENCHBOARD_INTERSW_GETBILLERCATEGORIES', 559);
|
||||
define('WRENCHBOARD_INTERSW_DO_TRANSFER', 560);
|
||||
define('WRENCHBOARD_INTERSW_QUERY_TRANSACTION', 561);
|
||||
|
||||
define('WRENCHBOARD_ADD_MONEYRECIPIENT', 600);
|
||||
|
||||
define('WRENCHBOARD_CREATE_USER_ACCOUNT', 700);
|
||||
define('WRENCHBOARD_USER_ACCOUNT_LOGIN', 710);
|
||||
define('WRENCHBOARD_START_PASSWORDRESET', 720);
|
||||
define('WRENCHBOARD_COMPLETE_PASSWORDRESET', 730);
|
||||
|
||||
//#define WRENCHBOARD_START_ADDMONEY', 770 );
|
||||
//#define WRENCHBOARD_COMPLETE_ADDMONEY' 775 );
|
||||
|
||||
define('WRENCHBOARD_ADD_MOBILE_TOPUPNUM', 900);
|
||||
define('WRENCHBOARD_PROMO_CALL', 990);
|
||||
|
||||
|
||||
define('WRENCHBOARD_STOREFACE_GET_ACCOUNT_BALANCE', 891);
|
||||
|
||||
define('WRENCHBOARD_LOG_ENTRY', 900000);
|
||||
define('WRENCHBOARD_CREDIT_TOPUP', 900010);
|
||||
|
||||
define('WRENCHBOARD_TOPUP_ORDER', 900020);
|
||||
define('WRENCHBOARD_TOPUP_ORDER_PURCHASE', 900030);
|
||||
define('WRENCHBOARD_PAYPAL_IPNMSG', 900090);
|
||||
|
||||
define('WRENCHBOARD_BULKTOPUP_ORDER', 700010);
|
||||
define('WRENCHBOARD_BULKTOPUP_ITEM', 700020);
|
||||
define('WRENCHBOARD_BULKTOPUP_ITEMUPDATE', 700030);
|
||||
define('WRENCHBOARD_BULKTOPUP_DELIVER', 700040);
|
||||
|
||||
define('WRENCHBOARD_BALANCE_TOPUP_ORDER', 800020);
|
||||
define('WRENCHBOARD_BALANCE_TOPUP_PURCHASE', 800030);
|
||||
define('WRENCHBOARD_BALANCE_TOPUP_PAYMENT', 800040);
|
||||
|
||||
define('VIRTUAL_AIRTOPUP', 70011);
|
||||
define('PAY_MODE_BALANCE', 0);
|
||||
define('PAY_MODE_CCARD', 1);
|
||||
define('PAY_MODE_BONUS', 9);
|
||||
define('APPROVED_BALANCE', 5);
|
||||
define('DISAPROVE_BALANCE', 3);
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
function formatCreateTranspData($in) {
|
||||
$in["member_id"] = $in["session_member_id"];
|
||||
$in['firstname'] = $in['patientinfo_firstname'];
|
||||
$in['lastname'] = $in['patientinfo_lastname'];
|
||||
$in['from_phone'] = $in['patientinfo_phone']; //
|
||||
|
||||
$in['from_street'] = $in['pickupaddress_streetaddress']; //
|
||||
//$in['from_aptno'] = $in['pickupaddress_aptno']; //
|
||||
$in['from_zipcode'] = $in['pickupaddress_zip']; //
|
||||
|
||||
$in['from_city'] = $in['pickupaddress_city']; //
|
||||
$in['from_state'] = $in['pickupaddress_state']; //
|
||||
$in['to_street'] = $in['dropoffaddress_streetaddress']; //
|
||||
//$in['to_aptno'] = $in['dropoffaddress_aptno']; //
|
||||
$in['to_zipcode'] = $in['dropoffaddress_zip']; //
|
||||
$in['to_city'] = $in['dropoffaddress_city']; //
|
||||
$in['to_state'] = $in['dropoffaddress_state']; //
|
||||
$in['facilityname'] = $in['dropoffaddress_facilityname']; //
|
||||
$in['transport_date'] = $in['datetime_currentdate'] . " " . $in['datetime_currentTime'];
|
||||
|
||||
// payment information
|
||||
$in['paymenttype'] = $in['paymentinfo_paymenttype']; //
|
||||
$in['paymentid'] = $in['paymentinfo_paymentid']; //
|
||||
$in['cardname'] = $in['paymentinfo_fullname']; //
|
||||
$in['cardnumber'] = $in['paymentinfo_cardnumber']; //
|
||||
$in['exp_month'] = $in['paymentinfo_exp_month']; //
|
||||
$in['exp_year'] = $in['paymentinfo_exp_year']; //
|
||||
$in['cvc'] = $in['paymentinfo_cvc']; //
|
||||
|
||||
|
||||
return $in;
|
||||
}
|
||||
|
||||
function processOutJson($in, $out) {
|
||||
if ($in["action"] != MEDTRANS_USER_GET_TRANSLIST) {
|
||||
// return $out;
|
||||
}
|
||||
|
||||
|
||||
switch ($in["action"]) {
|
||||
case WRENCHBOARD_START_JOBLIST:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"title" => $out["title_${key}"],
|
||||
"description" => $out["description_${key}"],
|
||||
"id" => $out["id_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
case MEDTRANS_USER_GET_LANGUAGE:
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"language" => $out["language_${key}"],
|
||||
"code" => $out["code_${key}"]
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case MEDTRANS_TRANSP_LISTLOCATION:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"agent_id" => $out["agent_id_${key}"],
|
||||
"street" => $out["street_${key}"],
|
||||
"city" => $out["city_${key}"],
|
||||
"id" => $out["id_${key}"],
|
||||
"state" => $out["state_${key}"],
|
||||
"zipcode" => $out["zipcode_${key}"],
|
||||
"state" => $out["state_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MEDTRANS_TRANSP_GETREASON:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"key" => $out["lkey_${key}"],
|
||||
"name" => $out["name_${key}"],
|
||||
"lorder" => $out["lorder_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return $out;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
include '../../backend.php';
|
||||
include 'constants.php';
|
||||
include 'formarter.php';
|
||||
|
||||
|
||||
$endpoints = array(
|
||||
'createuser' => array('POST'),
|
||||
'userlogin' => array('POST'),
|
||||
'startjoblist' => array('POST')
|
||||
);
|
||||
/*
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Allow-Headers", "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
|
||||
header("Access-Control-Allow-Methods", "POST, GET, PUT, DELETE, OPTIONS");
|
||||
//header("Access-Control-Expose-Headers: Access-Control-Allow-Origin");
|
||||
header('Content-type: application/json');
|
||||
|
||||
if ( "OPTIONS" === $_SERVER['REQUEST_METHOD'] ) {
|
||||
die();
|
||||
}
|
||||
*/
|
||||
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Expose-Headers: Access-Control-Allow-Origin");
|
||||
header("Access-Control-Allow-Headers: Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
|
||||
header("Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS");
|
||||
header('Content-type: application/json');
|
||||
|
||||
if ( "OPTIONS" === $_SERVER['REQUEST_METHOD'] ) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$endpoint = strtolower(str_replace('/svs/user/', '', strtok($_SERVER['REQUEST_URI'],'?')));
|
||||
|
||||
$id = 0; // update, get & delete actions require ID
|
||||
if (substr($endpoint,0,19)=='gettransportrequest'
|
||||
|| substr($endpoint,0,13)=='updateprofile') {
|
||||
$endpoint = strtok($endpoint,'/');
|
||||
$id = strtok('/');
|
||||
}
|
||||
|
||||
if (!isset($endpoints[$endpoint])) {
|
||||
header('HTTP/1.1 400 Bad Request');
|
||||
header('Status: 400 Bad Request');
|
||||
echo "{\"status\":\"Invalid endpoint url\"}";
|
||||
exit();
|
||||
}
|
||||
|
||||
$methods = $endpoints[$endpoint];
|
||||
|
||||
if (array_search($_SERVER['REQUEST_METHOD'], $methods)===false) {
|
||||
header('HTTP/1.1 405 Method Not Allowed');
|
||||
header('Status: 405 Method Not Allowed');
|
||||
echo "{\"status\":\"Invalid request method\"}";
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$in = flatten(json_decode(file_get_contents('php://input'), true));
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "PUT") {
|
||||
parse_str(file_get_contents('php://input'), $in);
|
||||
}
|
||||
|
||||
switch ($endpoint) {
|
||||
case 'createuser': $in["action"] = WRENCHBOARD_ACCOUNT_PENDING; $in["street1"] = $in["streetaddress"]; $in["zipcode"] = $in["zip"]; $in["country"] = "US"; $in["loc"] = $_SERVER["REMOTE_ADDR"]; break;
|
||||
case 'userlogin': $in["action"] = WRENCHBOARD_ACCOUNT_LOGIN; break;
|
||||
case 'startjoblist': $in["action"] = WRENCHBOARD_START_JOBLIST; break;
|
||||
|
||||
}
|
||||
$in["pid"] = 100;
|
||||
|
||||
//file_put_contents("in_debug.log", $in); // DEBUG
|
||||
|
||||
$out = array();
|
||||
$ret = $wrenchboard->wrenchboard_api($in, $out);
|
||||
$out['internal_return'] = $ret; // this is reserved array parameter - to be caprured and reoved before you use the out array()
|
||||
|
||||
header("HTTP/1.1 200 OK");
|
||||
header("Status: 200 OK");
|
||||
//$out = array_merge($in, $out); // DEBUG
|
||||
echo json_encode(processOutJson($in, $out));
|
||||
exit();
|
||||
|
||||
function flatten($data, $parentkey="") {
|
||||
$result = array();
|
||||
foreach ($data as $key=>$val) {
|
||||
if (is_array($val)) {
|
||||
$result = array_merge($result, flatten($val, $parentkey.$key."_"));
|
||||
} else {
|
||||
$result[$parentkey.$key] = $val;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// vi:ts=2
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$base_url = 'https://www.wrenchboard.com/svs/';
|
||||
$local_url = 'https://www.wrenchboard.com/svs/';
|
||||
?>
|
||||
@@ -0,0 +1,230 @@
|
||||
<?php
|
||||
require_once 'config.php';
|
||||
|
||||
|
||||
|
||||
define('PHP_API_OK', 0);
|
||||
define('PHP_LOGIN_OK', 100);
|
||||
define('PHP_CREATED_OK', 10);
|
||||
define('PHP_API_BAD_PARAM', -1);
|
||||
define('SESSION_TIMEOUT_LOGOUT',6000);
|
||||
|
||||
define('MOBILE_LOGIN', 1101);
|
||||
|
||||
define('SUPPORT_PHONE','+234 (818)-3866434');
|
||||
|
||||
define('UPLOAD_FILE_SIZE',1);
|
||||
|
||||
define('OFFER_ACCEPT',100);
|
||||
define('OFFER_REJECT',333);
|
||||
define('OFFER_CANCEL',222);
|
||||
define('OFFER_EXPIRE',444);
|
||||
|
||||
define('JOB_INTEREST_ACCEPT',100);
|
||||
define('JOB_INTEREST_REJECT',200);
|
||||
define('JOB_INTEREST_CANCEL',300);
|
||||
|
||||
define('SMONEY_PROCC_MANUAL',100);
|
||||
define('SMONEY_PROCC_AUTO',200);
|
||||
define('SMONEY_PROCC_INTERSWITCH',300);
|
||||
|
||||
define('ACCOUNT_AGREE_JOBS',100);
|
||||
define('ACCOUNT_AGREE_REFER',200);
|
||||
|
||||
|
||||
define('WRENCHBOARD_SESSION_CHECK', 299);
|
||||
define('WRENCHBOARD_USER_LOGIN', 300);
|
||||
define('WRENCHBOARD_USER_LOGOUT', 301);
|
||||
define('WRENCHBOARD_CREATE_ACCOUNT', 320);
|
||||
|
||||
define('CONTRACT_CANCEL_CONTRACT', 7);
|
||||
define('CONTRACT_EXTEND_TIMELINE', 9);
|
||||
define('CONTRACT_NOTIFY_COMPLETE', 4);
|
||||
define('CONTRACT_REQUEST_CANCEL', 3);
|
||||
define('CONTRACT_ACCEPT_COMPLETE', 5);
|
||||
define('CONTRACT_REJECT_COMPLETE', 1);
|
||||
|
||||
|
||||
//**************************************************************
|
||||
define('WRENCHBOARD_BKO_START', 10000);
|
||||
|
||||
define('WRENCHBOARD_BKO_LOGIN', 10010);
|
||||
define('WRENCHBOARD_BKO_CREATEUSER', 10015);
|
||||
define('WRENCHBOARD_BKO_UPDATEUSER', 10020);
|
||||
|
||||
define('WRENCHBOARD_BKO_END', 10999);
|
||||
//**************************************************************
|
||||
define('WRENCHBOARD_ACCOUNT_START', 11000);
|
||||
|
||||
define('WRENCHBOARD_ACCOUNT_TESTEMAIL', 11001);
|
||||
define('WRENCHBOARD_ACCOUNT_PENDING', 11010);
|
||||
|
||||
define('WRENCHBOARD_CREATE_MOBILEUSER', 11011 );
|
||||
define('WRENCHBOARD_COMPLETE_MOBILEUSER', 11012 );
|
||||
|
||||
define('WRENCHBOARD_RESET_PASSWORD', 11013 );
|
||||
define('WRENCHBOARD_ACCOUNT_JOBLIST',11014 );
|
||||
|
||||
define('WRENCHBOARD_VERIFY_PENDING_LINK', 11015);
|
||||
define('WRENCHBOARD_ACCOUNT_RESETPASS', 11016);
|
||||
define('WRENCHBOARD_ACCOUNT_SETPASSWD', 11017);
|
||||
|
||||
define('WRENCHBOARD_DELETE_PENDING_LINK', 11018);
|
||||
define('WRENCHBOARD_RESEND_PENDING_LINK', 11019);
|
||||
|
||||
|
||||
define('WRENCHBOARD_ACCOUNT_CREATEACC', 11020);
|
||||
define('WRENCHBOARD_ACCOUNT_LOGIN', 11025);
|
||||
define('WRENCHBOARD_FACEBOOK_LOGIN', 11026);
|
||||
define('WRENCHBOARD_START_JOBLIST', 11028);
|
||||
define('WRENCHBOARD_ACCOUNT_DASHDATA', 11029);
|
||||
|
||||
define('WRENCHBOARD_SEND_CONTACTUS', 11030);
|
||||
define('WRENCHBOARD_ACCOUNT_SENDREFER',11032);
|
||||
define('WRENCHBOARD_ACCOUNT_REFERLINK',11033);
|
||||
define('WRENCHBOARD_SESSION_VERIFY', 11034);
|
||||
define('WRENCHBOARD_UPDATE_PROFILE',11035);
|
||||
define('WRENCHBOARD_ACCOUNT_TERMS',11036);
|
||||
define('WRENCHBOARD_ACCOUNT_MDESCRIPTION',11037);
|
||||
define('WRENCHBOARD_ACCOUNT_SAVESKILL', 11038);
|
||||
define('WRENCHBOARD_ACCOUNT_DELSKILL', 11039);
|
||||
define('WRENCHBOARD_LOG_MEMBER', 11040);
|
||||
|
||||
define('WRENCHBOARD_DELETE_RECACC', 11041);
|
||||
define('WRENCHBOARD_SAVE_GALLERY', 11042);
|
||||
|
||||
define('WRENCHBOARD_ACCOUNT_PENDJOB', 11043 );
|
||||
|
||||
|
||||
define('WRENCHBOARD_USER_GETBANKLIST', 11050);
|
||||
define('WRENCHBOARD_USER_SENDMONEY', 11051);
|
||||
define('WRENCHBOARD_USER_SENDJOBINT', 11052);
|
||||
|
||||
define('WRENCHBOARD_ACCOUNT_WALLETS', 11060);
|
||||
|
||||
|
||||
define('WRENCHBOARD_ACCOUNT_END', 11999);
|
||||
//**************************************************************
|
||||
define('WRENCHBOARD_JOB_CREATEJOB',13010 );
|
||||
define('WRENCHBOARD_JOB_DELETEJOB',13011 );
|
||||
|
||||
define('WRENCHBOARD_JOB_GROUP_MEMBER', 13015) ;
|
||||
define('WRENCHBOARD_JOB_DELETE_GROUPMEMBER',13017);
|
||||
define('WRENCHBOARD_JOB_CREATE_GROUP', 13020);
|
||||
define('WRENCHBOARD_JOB_DELETE_GROUP',13023);
|
||||
|
||||
define('WRENCHBOARD_JOB_OFFER_INDVI',13030);
|
||||
define('WRENCHBOARD_JOB_OFFER_GROUP',13031);
|
||||
define('WRENCHBOARD_JOB_OFFER_PUBLIC',13032);
|
||||
define('WRENCHBOARD_JOB_SEND_INTEREST',13033);
|
||||
define('WRENCHBOARD_JOB_PROC_INTEREST',13034);
|
||||
define('WRENCHBOARD_JOB_OFFER_CONCLUDE',13035);
|
||||
define('WRENCHBOARD_JOB_SEND_QUESTION',13036);
|
||||
define('WRENCHBOARD_JOB_MRKTINT_QUEST',13037);
|
||||
define('WRENCHBOARD_JOB_REPLY_QUESTION',13038);
|
||||
//define('WRENCHBOARD_JOB_REPLY_QUESTION',13038);
|
||||
|
||||
//define('WRENCHBOARD_JOB_SEND_QUESTION',13036);
|
||||
|
||||
define('WRENCHBOARD_GROUP_START', 12000);
|
||||
|
||||
|
||||
define('WRENCHBOARD_GROUP_CREATEGROUP', 12010);
|
||||
define('WRENCHBOARD_GROUP_INVITEGROUP', 12015);
|
||||
define('WRENCHBOARD_GROUP_ACCEPTGROUP', 12020);
|
||||
|
||||
define('WRENCHBOARD_GROUP_END', 12999);
|
||||
//**************************************************************
|
||||
|
||||
define('WRENCHBOARD_CONTRACT_MESSAGE', 14010);
|
||||
define('WRENCHBOARD_CONTRACT_STATUS', 14015);
|
||||
|
||||
|
||||
define('WRENCHBOARD_MOBILE_OFFERSLIST', 15010);
|
||||
define('WRENCHBOARD_MOBILE_ACTIVEJOB', 15020);
|
||||
define('WRENCHBOARD_MOBILE_LOADPROFILE', 15030);
|
||||
define('WRENCHBOARD_MOBILE_ACCOUNT', 15040);
|
||||
define('WRENCHBOARD_MOBILE_MESSAGE', 15045);
|
||||
define('WRENCHBOARD_MOBILE_PAYMENTHX', 15046);
|
||||
define('WRENCHBOARD_MOBILE_TASKMESSAGE', 15047);
|
||||
define('WRENCHBOARD_MOBILE_SENDTASKMESSAGE', 15048);
|
||||
|
||||
|
||||
|
||||
|
||||
define('WRENCHBOARD_SMONEY_ADDRECIPIENT', 33010);
|
||||
define('WRENCHBOARD_SMONEY_MEMBER', 33020);
|
||||
define('WRENCHBOARD_SMONEY_PROCFEE', 33025);
|
||||
|
||||
define('WRENCHBOARD_SMONEY_BKOPROC', 33030 );
|
||||
|
||||
|
||||
define('WRENCHBOARD_LOGIN_SHOP', 50501);
|
||||
define('WRENCHBOARD_LOGIN_ADMIN', 50502);
|
||||
define('WRENCHBOARD_LOGIN_MANAGER', 50503);
|
||||
|
||||
define('WRENCHBOARD_SURVEY_DATA', 55000);
|
||||
define('WRENCHBOARD_ADD_SURVEY', 55050);
|
||||
define('WRENCHBOARD_LOAD_SURVEY', 55055);
|
||||
|
||||
|
||||
define('WRENCHBOARD_COMPLETE_SENDMONEY_INTERSW', 555);
|
||||
define('WRENCHBOARD_GETBILLER_INTERSW', 556);
|
||||
define('WRENCHBOARD_BILL_PAYMENT_ADVICE_INTERSW', 557);
|
||||
|
||||
define('WRENCHBOARD_INTERSW_GETBILLER', 556);
|
||||
define('WRENCHBOARD_INTERSW_BILL_PAYMENT_ADVICE', 557);
|
||||
define('WRENCHBOARD_INTERSW_GETBILLERPAYMENTINTEMS', 558);
|
||||
define('WRENCHBOARD_INTERSW_GETBILLERCATEGORIES', 559);
|
||||
define('WRENCHBOARD_INTERSW_DO_TRANSFER', 560);
|
||||
define('WRENCHBOARD_INTERSW_QUERY_TRANSACTION', 561);
|
||||
|
||||
define('WRENCHBOARD_ADD_MONEYRECIPIENT', 600);
|
||||
|
||||
define('WRENCHBOARD_CREATE_USER_ACCOUNT', 700);
|
||||
define('WRENCHBOARD_USER_ACCOUNT_LOGIN', 710);
|
||||
define('WRENCHBOARD_START_PASSWORDRESET', 720);
|
||||
define('WRENCHBOARD_COMPLETE_PASSWORDRESET', 730);
|
||||
|
||||
//#define WRENCHBOARD_START_ADDMONEY', 770 );
|
||||
//#define WRENCHBOARD_COMPLETE_ADDMONEY' 775 );
|
||||
|
||||
define('WRENCHBOARD_CARDS_GETCARDLIST', 40010);
|
||||
define('WRENCHBOARD_CARDS_UPDATECARD', 40015) ;
|
||||
|
||||
define('WRENCHBOARD_COUPON_REDEEM', 85020);
|
||||
define('WRENCHBOARD_COUPON_MEMLIST', 85025);
|
||||
define('WRENCHBOARD_COUPON_PENDLIST', 85030);
|
||||
|
||||
|
||||
define('WRENCHBOARD_ADD_MOBILE_TOPUPNUM', 900);
|
||||
define('WRENCHBOARD_PROMO_CALL', 990);
|
||||
|
||||
|
||||
define('WRENCHBOARD_STOREFACE_GET_ACCOUNT_BALANCE', 891);
|
||||
|
||||
define('WRENCHBOARD_LOG_ENTRY', 900000);
|
||||
define('WRENCHBOARD_CREDIT_TOPUP', 900010);
|
||||
|
||||
define('WRENCHBOARD_TOPUP_ORDER', 900020);
|
||||
define('WRENCHBOARD_TOPUP_ORDER_PURCHASE', 900030);
|
||||
define('WRENCHBOARD_PAYPAL_IPNMSG', 900090);
|
||||
|
||||
define('WRENCHBOARD_BULKTOPUP_ORDER', 700010);
|
||||
define('WRENCHBOARD_BULKTOPUP_ITEM', 700020);
|
||||
define('WRENCHBOARD_BULKTOPUP_ITEMUPDATE', 700030);
|
||||
define('WRENCHBOARD_BULKTOPUP_DELIVER', 700040);
|
||||
|
||||
define('WRENCHBOARD_BALANCE_TOPUP_ORDER', 800020);
|
||||
define('WRENCHBOARD_BALANCE_TOPUP_PURCHASE', 800030);
|
||||
define('WRENCHBOARD_BALANCE_TOPUP_PAYMENT', 800040);
|
||||
|
||||
define('VIRTUAL_AIRTOPUP', 70011);
|
||||
define('PAY_MODE_BALANCE', 0);
|
||||
define('PAY_MODE_CCARD', 1);
|
||||
define('PAY_MODE_BONUS', 9);
|
||||
define('APPROVED_BALANCE', 5);
|
||||
define('DISAPROVE_BALANCE', 3);
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,341 @@
|
||||
<?php
|
||||
|
||||
function formatCreateTranspData($in) {
|
||||
$in["member_id"] = $in["session_member_id"];
|
||||
$in['firstname'] = $in['patientinfo_firstname'];
|
||||
$in['lastname'] = $in['patientinfo_lastname'];
|
||||
$in['from_phone'] = $in['patientinfo_phone']; //
|
||||
|
||||
$in['from_street'] = $in['pickupaddress_streetaddress']; //
|
||||
//$in['from_aptno'] = $in['pickupaddress_aptno']; //
|
||||
$in['from_zipcode'] = $in['pickupaddress_zip']; //
|
||||
|
||||
$in['from_city'] = $in['pickupaddress_city']; //
|
||||
$in['from_state'] = $in['pickupaddress_state']; //
|
||||
$in['to_street'] = $in['dropoffaddress_streetaddress']; //
|
||||
//$in['to_aptno'] = $in['dropoffaddress_aptno']; //
|
||||
$in['to_zipcode'] = $in['dropoffaddress_zip']; //
|
||||
$in['to_city'] = $in['dropoffaddress_city']; //
|
||||
$in['to_state'] = $in['dropoffaddress_state']; //
|
||||
$in['facilityname'] = $in['dropoffaddress_facilityname']; //
|
||||
$in['transport_date'] = $in['datetime_currentdate'] . " " . $in['datetime_currentTime'];
|
||||
|
||||
// payment information
|
||||
$in['paymenttype'] = $in['paymentinfo_paymenttype']; //
|
||||
$in['paymentid'] = $in['paymentinfo_paymentid']; //
|
||||
$in['cardname'] = $in['paymentinfo_fullname']; //
|
||||
$in['cardnumber'] = $in['paymentinfo_cardnumber']; //
|
||||
$in['exp_month'] = $in['paymentinfo_exp_month']; //
|
||||
$in['exp_year'] = $in['paymentinfo_exp_year']; //
|
||||
$in['cvc'] = $in['paymentinfo_cvc']; //
|
||||
|
||||
|
||||
return $in;
|
||||
}
|
||||
function cleanUpDescription($job_description){
|
||||
// $job_description = trim($job_description); // trim it first
|
||||
|
||||
/*
|
||||
*
|
||||
* $rest = substr("abcdef", -1); // returns "f"
|
||||
$rest = substr("abcdef", -2); // returns "ef"
|
||||
$rest = substr("abcdef", -3, 1); // returns "d"
|
||||
*/
|
||||
|
||||
if ( substr($job_description,0,1)==='"' ){
|
||||
// $job_description = substr($job_description,1);
|
||||
}
|
||||
$job_description =fixtags($job_description);
|
||||
|
||||
if ( substr($job_description,0,1)==='"' ){
|
||||
// $job_description = substr($job_description,2);
|
||||
}
|
||||
return $job_description;
|
||||
}
|
||||
function fixtags($text){
|
||||
$text = htmlspecialchars($text);
|
||||
$text = preg_replace("/=/", "=\"\"", $text);
|
||||
$text = preg_replace("/"/", ""\"", $text);
|
||||
$tags = "/<(\/|)(\w*)(\ |)(\w*)([\\\=]*)(?|(\")\""\"|)(?|(.*)?"(\")|)([\ ]?)(\/|)>/i";
|
||||
$replacement = "<$1$2$3$4$5$6$7$8$9$10>";
|
||||
$text = preg_replace($tags, $replacement, $text);
|
||||
$text = preg_replace("/=\"\"/", "=", $text);
|
||||
$text = str_replace("\\n", "<br />", $text);
|
||||
|
||||
$text = str_replace('""\"','',$text);
|
||||
$text = str_replace('"\""','',$text);
|
||||
$text = str_replace(' ','',$text);
|
||||
|
||||
$text = str_replace('href=\\"\"http://','',$text);
|
||||
$text = str_replace('href=\\"\"https://','',$text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
function processOutJson($in, $out) {
|
||||
|
||||
|
||||
// id AS coupon_id, ca.code, ca.amount, ca.added::date,ca.status
|
||||
switch ($in["action"]) {
|
||||
case WRENCHBOARD_CARDS_GETCARDLIST:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"assign_id" => $out["assign_id_${key}"],
|
||||
"title" => $out["title_${key}"],
|
||||
"description" => $out["description_${key}"],
|
||||
"card_type" => $out["card_type_${key}"],
|
||||
"card_style" => $out["card_style_${key}"],
|
||||
"card_icon" => $out["card_icon_${key}"] );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_COUPON_MEMLIST:
|
||||
case WRENCHBOARD_COUPON_PENDLIST:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"coupon_id" => $out["coupon_id_${key}"],
|
||||
"code" => $out["code_${key}"],
|
||||
"amount" => $out["amount_${key}"],
|
||||
"added" => $out["added_${key}"],
|
||||
"status" => $out["status_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_MOBILE_TASKMESSAGE:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"title" => $out["title_${key}"],
|
||||
"msg" => $out["msg_${key}"],
|
||||
"msg_id" => $out["msg_id_${key}"],
|
||||
"date" => $out["date_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_START_JOBLIST:
|
||||
case WRENCHBOARD_ACCOUNT_JOBLIST:
|
||||
case WRENCHBOARD_ACCOUNT_PENDJOB:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"title" => $out["title_${key}"],
|
||||
"description" => $out["description_${key}"],
|
||||
"id" => $out["id_${key}"],
|
||||
"job_description" => cleanUpDescription($out["job_description_${key}"]),
|
||||
"price" => $out["price_${key}"],
|
||||
"timeline_days" => $out["timeline_days_${key}"],
|
||||
"expire" => $out["expire_${key}"],
|
||||
"sent" => $out["sent_${key}"],
|
||||
"offer_code" => $out["offer_code_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
case WRENCHBOARD_MOBILE_ACTIVEJOB:
|
||||
case WRENCHBOARD_MOBILE_OFFERSLIST:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"title" => $out["title_${key}"],
|
||||
"description" => $out["description_${key}"],
|
||||
"id" => $out["id_${key}"],
|
||||
"job_description" => $out["job_description_${key}"],
|
||||
"price" => $out["price_${key}"],
|
||||
"timeline_days" => $out["timeline_days_${key}"],
|
||||
|
||||
"contract_id" => $out["contract_id_${key}"],
|
||||
"job_id" => $out["job_id_${key}"],
|
||||
"contract" => $out["contract_${key}"],
|
||||
"status_description" => $out["status_description_${key}"],
|
||||
|
||||
"delivery_date" => $out["delivery_date_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
case WRENCHBOARD_MOBILE_MESSAGE:
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"msg" => $out["msg_${key}"],
|
||||
"msg_id" => $out["msg_id_${key}"],
|
||||
"msg_date" => $out["msg_date_${key}"],
|
||||
"msg_from" => $out["msg_from_${key}"],
|
||||
"reply" => $out["reply_${key}"],
|
||||
"message_mode" => $out["message_mode_${key}"],
|
||||
"uid" => $out["uid_${key}"],
|
||||
"memo" => $out["memo_${key}"]
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_MOBILE_PAYMENTHX:
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"fee" => $out["fee_${key}"],
|
||||
"amount" => $out["amount_${key}"],
|
||||
"recipient" => $out["recipient_${key}"],
|
||||
"confirmation" => $out["confirmation_${key}"],
|
||||
"status" => $out["status_${key}"],
|
||||
"trx_date" => $out["trx_date_${key}"],
|
||||
"trx_id" => $out["trx_id_${key}"]
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_USER_GETBANKLIST:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"recipient" => $out["recipient_${key}"],
|
||||
"account_no" => $out["account_no_${key}"],
|
||||
"bank_id" => $out["bank_id_${key}"],
|
||||
"added" => $out["added_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_ACCOUNT_WALLETS:
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"currency" => $out["currency_${key}"],
|
||||
"amount" => $out["amount_${key}"],
|
||||
"symbol" => $out["symbol_${key}"],
|
||||
"description" => $out["description_${key}"],
|
||||
"action_type" => $out["action_type_${key}"],
|
||||
"code" => $out["code_${key}"]
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return $out;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
function getBlogData(){
|
||||
return [
|
||||
[
|
||||
'meta_value' => "https://blog.wrenchboard.com/wp-content/uploads/2022/01/universitty.jpg",
|
||||
'post_date' => "2018-06-25T18:54:22.000Z",
|
||||
'post_date_gmt' => "2018-06-25T18:54:22.000Z",
|
||||
'post_content' => "Globalization spells danger for the type of jobs that will be available at graduation. The nature of jobs changes so often that it could frustrate for the students. The changes also present new opportunities. Globalization also ensures that job can come anonymously from any part of the world and transaction can be completed privately.\n\nThis is where <a href=\"https://www.wrenchboard.com\">WrenchBoard </a>comes in, rather than focus on your primary education as your source of income, the new economy will look at your skills as this guide. Your question is to self-examine and attributes values to what you have that others need to make their own or goal complete.\n\nUniversity students can earn extra income along with their regular educational and school work by taking part-time tasks online. To get a project up and running there are a lot of components of service that every business goes through and there are those tasks that students can attend to. Students are in best position to do an initial critique of sites, write articles that bear innocence or interest meddling or test an app for a company in beta phase.\n\nThe online nature of the jobs gives the student the necessary flexibility to operate and added the benefit of interacting with people that don’t think like them, it is an opportunity for the larger world. It is getting very hard to manufacture excuses for not to be involved with one online job or the other when the opportunities and the capabilities collide. A student should be made aware of the fact that life is going to get busier once the excuse of the school is removed.\n\nThere are many jobs students can easily do online\n<ul>\n \t<li>\tOnline marketing - most students have Facebooks and other social environments with tons of friends or connection. Somebody on this planet needs that profile or demography and will be will to pay for it if there is a way to do so</li>\n \t<li>\nTeaching - being a student also has the benefit of living in environment where you play with commercial tools, somebody have question about those tools you are playing with that they are willing to pay for - for example, student work with expensive robots in labs and an industrial hand may have questions that you can check out in your experiment environment</li>\n \t<li>\nWriting Articles/Blogging -</li>\n \t<li>\nSurveys/Research</li>\n \t<li>Campaigns</li>\n</ul>",
|
||||
'post_title' => "Online Jobs for University Students",
|
||||
],
|
||||
[
|
||||
'meta_value' => "https://blog.wrenchboard.com/wp-content/uploads/2022/01/time_manageent.jpg",
|
||||
'post_date' => "2017-11-23T14:05:51.000Z",
|
||||
'post_date_gmt' => "2017-11-23T14:05:51.000Z",
|
||||
'post_content' => "There are different types of online jobs and some pay more money than others do while some typing jobs may need special equipment, education, or training in order to do them. The advantage of an online job is that you can work at any time of the day around your personal schedule. You can even work in the evening or at night.\n\nYour income from an online job will also depend on the kind of job you do, your experience and your skills.\n\n<strong>Price management</strong>\n\nFirstly, you will need to establish the services you will offer your clients and a business essentially succeeds by filling a void or a niche in the market.\n\nEnsure you are familiar with the different online jobs out there as each job category pays differently. The categories of online jobs include Copywriting, SEO copywriting, Content writing, Proofreading, editing, freelance writing, social media marketing and professional blogging. You do not have to work in one field only; you can work in various fields. Research on how much each field pays; this is so you do not sell yourself short and earn less money than you should be earning.\n\nAlways do your best work for every project as the quality of your work will speak for you and you can gauge your prices better while establishing your reputation.\n\nNetworking is also essential both online and in person. You can use social media platforms like LinkedIn to network online. The more you work towards being noticed, the more clients and projects you will get.\n\n<strong>Time management </strong>\n\nWorking an online business means, you will be working from home in most cases and time management is an essential part of working online. Here are a few tips to help you manage your time better with an online job.\n<ul>\n \t<li>Remove all the extra tabs from your web browser, as they can be reminders of the fact that the internet is a vast wormhole of your attention. Open fewer tabs if you want to have a more productive workday.</li>\n \t<li>Remove papers from your desktop as a ton of paperwork on your desktop could discourage you from remaining focused. Ensure you clear your desktop after each workday.</li>\n \t<li>Avoid social media interruptions as social media can hinder your productivity if you do not practice mindfulness. You can set up a specific time to socialize before your workday begins or just before retiring after your workday.</li>\n \t<li>Block any needless distractions because at times pure silence might be all you need to do to enhance your production. Turn your radio, television, or telephone off. Avoid visiting any social media platforms, ignore email notifications, and even close your browser.</li>\n \t<li>Select the best time for you to work; you may find that you are more productive during certain hours of the day. Find out what your optimal time frame is and work during said hours so that you get more work done. Most importantly, ensure you follow your schedule strictly.</li>\n</ul>\n ",
|
||||
'post_title' => "Time and price management when working an online job",
|
||||
],
|
||||
[
|
||||
'meta_value' => "https://blog.wrenchboard.com/wp-content/uploads/2022/01/man_reading.jpg",
|
||||
'post_date' => "2017-11-23T14:04:49.000Z",
|
||||
'post_date_gmt' => "2017-11-23T14:04:49.000Z",
|
||||
'post_content' => "Content syndication involves methods of content republication on other websites so you can reach a wider audience. Syndication of your content is a great way to enhance your brand awareness and your reach, direct traffic to your article, and build links. The internet is vast and it is not reasonable to assume that everyone you want to reach will read your content simply because you published it on your own site. Syndicating your content gets it to a different audience who might have never known it was there in the first place. Content syndication is a good and cheap way to further your content. It is a content marketing strategy. There are 4 kinds of content syndication you should know of:\n<ol>\n \t<li><strong>Syndicating content (3rd party) on your website </strong></li>\n</ol>\nPublishers can ask different websites for permission to display their content on your website or blog. Your site should have roughly 10% syndicated content ideally. Even though it might be unoriginal, it is always good to feature useful content that your readers will find beneficial and worth reading. It is difficult to find great authors committed to writing content for you when you run a website or blog with multiple authors. Ask an influencer on whether you can feature their existing content as a reasonable resolution. Syndicated content diversifies your site content instantly by highlighting something valuable and new to your target audience.\n<ol start=\"2\">\n \t<li><strong>Syndicating your content on other blogs or websites</strong></li>\n</ol>\nPublishers can syndicate their content to be displayed on another partner website or sites. You can either create content that is not original for your partner who will just be republishing your content. Alternatively, you can agree on a split which both sides find acceptable i.e. you can give them syndicated content for one month and produce original content the next month. If the agreement calls for 1-4 posts monthly, one of them must at least be original.\n<ol start=\"3\">\n \t<li><strong>Publish your content on websites syndicating their content</strong></li>\n</ol>\nAnother way to syndicate your content is by contributing regularly to websites already syndicating their content. Think of it this way, if you are publishing your content for a specific website on a regular basis and they are content syndicators, their content would also end up on other significant partner websites.\n<ol start=\"4\">\n \t<li><strong>Self-service syndication</strong></li>\n</ol>\nPublishers are also able to syndicate their own content with Medium as a great place to start with this endeavor. Medium allows you to import your already existing content from the internet edit, format, and publishing it. It allows you to run your own publications using minimal effort. LinkedIn is another platform you can use to republish your own website content so it reaches a bigger audience.\n\nYou have tools available at your disposal that can help you get your content to a wider target audience while enhancing traffic to your website, establishing a stronger following, and developing your reputation.",
|
||||
'post_title' => "How to use syndication techniques to promote your articles online",
|
||||
],
|
||||
[
|
||||
'meta_value' => "https://blog.wrenchboard.com/wp-content/uploads/2022/01/wrechboard-sample.jpg",
|
||||
'post_date' => "2017-11-23T14:03:39.000Z",
|
||||
'post_date_gmt' => "2017-11-23T14:03:39.000Z",
|
||||
'post_content' => "<strong>Paying mind to similarity index and why ignoring it could have serious repercussions </strong>\n\nThe similarity index is a term you should be familiar with as an online writer. It is defined as the composite number that is highlighted after matching two texts to determine how similar the content from both pieces is. It is typically displayed as a percentage and the displayed number measures the percentage of your article that the program found the matching text for. This is regardless of proper citation in your work or lack thereof.\n\nIf the similarity index is high this could mean the writer has quoted various other works to a large extent even if it is legitimate.\n\nIt is understandable that you will want to offer quality content for search engines in terms of consideration and indexation and this can lead you to weed your indexable content down. You may also be worried that search engines will not be able to comprehend your content due to existing similar pages because of things like product variations. It will be unwise for you to rush into a decision that could damage your SEO in the process of trying to make search engines happy while destroying your organic visibility in the process.\n\nYou can make use of canonical tags to instruct crawling search engines of the representative alternatives of similar or duplicate content. You just have to place these tags within your source code head section. Canonical tags are very effective in dealing with similar or duplicate content. The easiest way to determine whether you have similar content on your website is to review the site manually while addressing sections of the site appearing to have different URLs but similar content. Take some of the URLs and use tools such as Similar Page Checker or simply review the site for any similar content using Siteliner.\n\nYou may also want to consider consolidating multiple pages into one or expanding certain pages if you have multiple pages that appear to be similar. For example, if you have a site with two distinct pages for different but related topics but the information is the same on both these pages, you may either expand each page further to encompass original content about each topic or merge both pages into one about both topics.\n\nSimilar content can present an issue if not addressed:\n\nYour website will suffer in terms of ranking and you may end up losing traffic. Both losses typically originate from 2 main issues\n\n- Search engines rarely show multiple options of similar content in order to give users an optimum search experience. They will, therefore, be forced to select the best version which will be shown as the best result diluting visibility of websites with similar or duplicate content.\n\n- Equity of links will also be diluted further because other websites will have to choose the best option from the duplicates. As opposed to all the inbound links directing to one content piece, they will link to several pieces distributing the equity of the links among these duplicates. Inbound links are considered a ranking factor so they can affect the search visibility of certain pieces of content.\n\nThe overall result is that the piece of content will not get the search visibility it deserves.\n\n ",
|
||||
'post_title' => "Paying mind to similarity index",
|
||||
]
|
||||
];
|
||||
//return $blogData;
|
||||
}
|
||||
|
||||
function getBlogItem(){
|
||||
return [
|
||||
[
|
||||
'meta_value' => "https://blog.wrenchboard.com/wp-content/uploads/2022/01/universitty.jpg",
|
||||
'post_date' => "2018-06-25T18:54:22.000Z",
|
||||
'post_date_gmt' => "2018-06-25T18:54:22.000Z",
|
||||
'post_content' => "Globalization spells danger for the type of jobs that will be available at graduation. The nature of jobs changes so often that it could frustrate for the students. The changes also present new opportunities. Globalization also ensures that job can come anonymously from any part of the world and transaction can be completed privately.\n\nThis is where <a href=\"https://www.wrenchboard.com\">WrenchBoard </a>comes in, rather than focus on your primary education as your source of income, the new economy will look at your skills as this guide. Your question is to self-examine and attributes values to what you have that others need to make their own or goal complete.\n\nUniversity students can earn extra income along with their regular educational and school work by taking part-time tasks online. To get a project up and running there are a lot of components of service that every business goes through and there are those tasks that students can attend to. Students are in best position to do an initial critique of sites, write articles that bear innocence or interest meddling or test an app for a company in beta phase.\n\nThe online nature of the jobs gives the student the necessary flexibility to operate and added the benefit of interacting with people that don’t think like them, it is an opportunity for the larger world. It is getting very hard to manufacture excuses for not to be involved with one online job or the other when the opportunities and the capabilities collide. A student should be made aware of the fact that life is going to get busier once the excuse of the school is removed.\n\nThere are many jobs students can easily do online\n<ul>\n \t<li>\tOnline marketing - most students have Facebooks and other social environments with tons of friends or connection. Somebody on this planet needs that profile or demography and will be will to pay for it if there is a way to do so</li>\n \t<li>\nTeaching - being a student also has the benefit of living in environment where you play with commercial tools, somebody have question about those tools you are playing with that they are willing to pay for - for example, student work with expensive robots in labs and an industrial hand may have questions that you can check out in your experiment environment</li>\n \t<li>\nWriting Articles/Blogging -</li>\n \t<li>\nSurveys/Research</li>\n \t<li>Campaigns</li>\n</ul>",
|
||||
'post_title' => "Online Jobs for University Students ITEM",
|
||||
]
|
||||
];
|
||||
//return $blogData;
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
function formatCreateTranspData($in) {
|
||||
$in["member_id"] = $in["session_member_id"];
|
||||
$in['firstname'] = $in['patientinfo_firstname'];
|
||||
$in['lastname'] = $in['patientinfo_lastname'];
|
||||
$in['from_phone'] = $in['patientinfo_phone']; //
|
||||
|
||||
$in['from_street'] = $in['pickupaddress_streetaddress']; //
|
||||
//$in['from_aptno'] = $in['pickupaddress_aptno']; //
|
||||
$in['from_zipcode'] = $in['pickupaddress_zip']; //
|
||||
|
||||
$in['from_city'] = $in['pickupaddress_city']; //
|
||||
$in['from_state'] = $in['pickupaddress_state']; //
|
||||
$in['to_street'] = $in['dropoffaddress_streetaddress']; //
|
||||
//$in['to_aptno'] = $in['dropoffaddress_aptno']; //
|
||||
$in['to_zipcode'] = $in['dropoffaddress_zip']; //
|
||||
$in['to_city'] = $in['dropoffaddress_city']; //
|
||||
$in['to_state'] = $in['dropoffaddress_state']; //
|
||||
$in['facilityname'] = $in['dropoffaddress_facilityname']; //
|
||||
$in['transport_date'] = $in['datetime_currentdate'] . " " . $in['datetime_currentTime'];
|
||||
|
||||
// payment information
|
||||
$in['paymenttype'] = $in['paymentinfo_paymenttype']; //
|
||||
$in['paymentid'] = $in['paymentinfo_paymentid']; //
|
||||
$in['cardname'] = $in['paymentinfo_fullname']; //
|
||||
$in['cardnumber'] = $in['paymentinfo_cardnumber']; //
|
||||
$in['exp_month'] = $in['paymentinfo_exp_month']; //
|
||||
$in['exp_year'] = $in['paymentinfo_exp_year']; //
|
||||
$in['cvc'] = $in['paymentinfo_cvc']; //
|
||||
|
||||
|
||||
return $in;
|
||||
}
|
||||
|
||||
function processOutJson($in, $out) {
|
||||
if ($in["action"] != MEDTRANS_USER_GET_TRANSLIST) {
|
||||
// return $out;
|
||||
}
|
||||
|
||||
|
||||
switch ($in["action"]) {
|
||||
case MEDTRANS_USER_GET_TRANSLIST:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"transport_date" => $out["transport_date_${key}"],
|
||||
"firstname" => $out["firstname_${key}"],
|
||||
"lastname" => $out["lastname_${key}"],
|
||||
"from_phone" => $out["from_phone_${key}"],
|
||||
"from_street" => $out["from_street_${key}"],
|
||||
"to_street" => $out["to_street_${key}"],
|
||||
"from_city" => $out["from_city_${key}"],
|
||||
"to_city" => $out["to_city_${key}"],
|
||||
"from_state" => $out["from_state_${key}"],
|
||||
"to_state" => $out["to_state_${key}"],
|
||||
"from_zipcode" => $out["from_zipcode_${key}"],
|
||||
"to_zipcode" => $out["to_zipcode_${key}"],
|
||||
"flags" => $out["flags_${key}"],
|
||||
"miles" => $out["distance_${key}"],
|
||||
"transport" => $out["transport_${key}"],
|
||||
"translate" => $out["translate_${key}"],
|
||||
"lang_code" => $out["lang_code_${key}"],
|
||||
"language" => $out["language_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
case MEDTRANS_USER_GET_LANGUAGE:
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"language" => $out["language_${key}"],
|
||||
"code" => $out["code_${key}"]
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case MEDTRANS_TRANSP_LISTLOCATION:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"agent_id" => $out["agent_id_${key}"],
|
||||
"street" => $out["street_${key}"],
|
||||
"city" => $out["city_${key}"],
|
||||
"id" => $out["id_${key}"],
|
||||
"state" => $out["state_${key}"],
|
||||
"zipcode" => $out["zipcode_${key}"],
|
||||
"state" => $out["state_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MEDTRANS_TRANSP_GETREASON:
|
||||
|
||||
$total = $out["total_record"];
|
||||
$res = array(
|
||||
"status" => $out["status"],
|
||||
"total_record" => ($total - 1),
|
||||
"internal_return" => $out["internal_return"],
|
||||
"result_list" => array(),
|
||||
);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$key = sprintf("%05d", $i);
|
||||
$res["result_list"][] = array(
|
||||
"key" => $out["lkey_${key}"],
|
||||
"name" => $out["name_${key}"],
|
||||
"lorder" => $out["lorder_${key}"]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return $out;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<?php include 'userve.php';
|
||||
@@ -0,0 +1,316 @@
|
||||
<?php
|
||||
/*
|
||||
* USER DATA API END POINT
|
||||
*
|
||||
*/
|
||||
include '../../backend.php';
|
||||
include 'constants.php';
|
||||
include 'formarter.php';
|
||||
|
||||
$endpoints = array(
|
||||
'apigate' => array('POST'),
|
||||
'generics' => array('POST'),
|
||||
'createuser' => array('POST'),
|
||||
'createmobileuser' => array('POST'),
|
||||
'completemobileuser' => array('POST'),
|
||||
'startresetpasword' => array('POST'),
|
||||
'userlogin' => array('POST'),
|
||||
'startjoblist' => array('POST'),
|
||||
'dashdata' => array('POST'),
|
||||
'getjobsdata' => array('POST'),
|
||||
'offerslist' => array('POST'),
|
||||
'activejoblist' => array('POST'),
|
||||
'loadprofile' => array('POST'),
|
||||
'account' => array('POST'),
|
||||
'message' => array('POST'),
|
||||
'pendingjob' => array('POST'),
|
||||
'paymenthx' => array('POST'),
|
||||
'getjob' => array('POST'),
|
||||
'mybanklist' => array('POST'),
|
||||
'sendmoney' => array('POST'),
|
||||
'sendinterest' => array('POST'),
|
||||
'sendmoneyfee' => array('POST'),
|
||||
'getpendingjobs' => array('POST'),
|
||||
'taskmessage' => array('POST'),
|
||||
'sendtaskmessage' => array('POST'),
|
||||
'getwallets' => array('POST'),
|
||||
'sitecontact' => array('POST'),
|
||||
'signupcountry' => array('POST'),
|
||||
'userscards' => array('POST'),
|
||||
'blogdata' => array('POST'),
|
||||
'blogitem' => array('POST'),
|
||||
'couponhx' => array('POST'),
|
||||
'couponpending' => array('POST'),
|
||||
'couponredeem' => array('POST'),
|
||||
'sendinterestmessage' => array('POST'),
|
||||
'replyinterestmessage' => array('POST')
|
||||
);
|
||||
|
||||
$call_backend = true; // sometimes we need to overwite the call to the extenstion API
|
||||
$local_out = []; // use local out to send output when the result is not from the extenstion
|
||||
$ret = -1;
|
||||
|
||||
/*
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Allow-Headers", "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
|
||||
header("Access-Control-Allow-Methods", "POST, GET, PUT, DELETE, OPTIONS");
|
||||
//header("Access-Control-Expose-Headers: Access-Control-Allow-Origin");
|
||||
header('Content-type: application/json');
|
||||
if ( "OPTIONS" === $_SERVER['REQUEST_METHOD'] ) {
|
||||
die();
|
||||
}
|
||||
*/
|
||||
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Expose-Headers: Access-Control-Allow-Origin");
|
||||
header("Access-Control-Allow-Headers: Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
|
||||
header("Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS");
|
||||
header('Content-type: application/json');
|
||||
|
||||
if ("OPTIONS" === $_SERVER['REQUEST_METHOD']) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$endpoint = strtolower(str_replace('/svs/user/', '', strtok($_SERVER['REQUEST_URI'], '?')));
|
||||
|
||||
$id = 0; // update, get & delete actions require ID
|
||||
if (substr($endpoint, 0, 19) == 'gettransportrequest' || substr($endpoint, 0, 13) == 'updateprofile') {
|
||||
$endpoint = strtok($endpoint, '/');
|
||||
$id = strtok('/');
|
||||
}
|
||||
|
||||
if (!isset($endpoints[$endpoint])) {
|
||||
header('HTTP/1.1 400 Bad Request');
|
||||
header('Status: 400 Bad Request');
|
||||
echo "{\"status\":\"Invalid endpoint url WRB\"}";
|
||||
exit();
|
||||
}
|
||||
|
||||
$methods = $endpoints[$endpoint];
|
||||
|
||||
if (array_search($_SERVER['REQUEST_METHOD'], $methods) === false) {
|
||||
header('HTTP/1.1 405 Method Not Allowed');
|
||||
header('Status: 405 Method Not Allowed');
|
||||
echo "{\"status\":\"Invalid request method\"}";
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$in = flatten(json_decode(file_get_contents('php://input'), true));
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "PUT") {
|
||||
parse_str(file_get_contents('php://input'), $in);
|
||||
}
|
||||
if ($_SERVER["REQUEST_METHOD"] == "GET") {
|
||||
$in = $_GET;
|
||||
}
|
||||
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
||||
switch ($endpoint) {
|
||||
case 'replyinterestmessage':
|
||||
$in["action"] = WRENCHBOARD_JOB_REPLY_QUESTION;
|
||||
break;
|
||||
case 'sendinterestmessage':
|
||||
// $in['offer_code'] = $this->input->get('offer_code');
|
||||
$in['yourmessage'] = $in["question"];
|
||||
//$in['member_id'] = $_SESSION['member_id']; // just maing sure
|
||||
$in['msg_type'] = 'JOB';
|
||||
// $in['action'] = WRENCHBOARD_JOB_SEND_QUESTION;
|
||||
|
||||
$in["action"] = WRENCHBOARD_JOB_SEND_QUESTION;
|
||||
break;
|
||||
case 'couponredeem':
|
||||
$in["action"] = WRENCHBOARD_COUPON_REDEEM;
|
||||
break;
|
||||
case 'couponpending':
|
||||
$in["action"] = WRENCHBOARD_COUPON_PENDLIST;
|
||||
break;
|
||||
case 'couponhx':
|
||||
$in["action"] = WRENCHBOARD_COUPON_MEMLIST;
|
||||
break;
|
||||
case 'signupcountry':
|
||||
$local_out = [
|
||||
'result'=>'100',
|
||||
'signup_country'=>[
|
||||
['NG', 'Nigeria'],
|
||||
['US', 'United States']
|
||||
]
|
||||
];
|
||||
$call_backend = false;
|
||||
break;
|
||||
case 'blogitem':
|
||||
$blogData = getBlogItem();
|
||||
$local_out = [
|
||||
'result'=>'100',
|
||||
'blog_data'=> $blogData
|
||||
];
|
||||
$call_backend = false;
|
||||
break;
|
||||
case 'blogdata':
|
||||
$blogData = getBlogData();
|
||||
$local_out = [
|
||||
'result'=>'100',
|
||||
'blog_data'=> $blogData
|
||||
];
|
||||
$call_backend = false;
|
||||
break;
|
||||
case 'userscards':
|
||||
$in["action"] = WRENCHBOARD_CARDS_GETCARDLIST;
|
||||
$local_out = [
|
||||
'result'=>'100',
|
||||
'result_list'=>[
|
||||
['title'=>'This is your coupon',
|
||||
'description'=>'This is the description of the description',
|
||||
'card_type'=>'COUPON',
|
||||
'card_style' =>'card1',
|
||||
'card_icon' =>'icon1',
|
||||
'assign_id'=> 0,
|
||||
'Nigeria'],
|
||||
['title'=>'A Recommended Story',
|
||||
'description'=>'This is the description of the description',
|
||||
'card_type'=>'BLOG',
|
||||
'card_style' =>'card2',
|
||||
'card_icon' =>'icon1',
|
||||
'assign_id'=> 0,
|
||||
'United States'],
|
||||
['title'=>'You have a new task sent to you',
|
||||
'description'=>'This is the description of the description',
|
||||
'card_type'=>'NEWTASK',
|
||||
'card_style' =>'card1',
|
||||
'card_icon' =>'icon1',
|
||||
'assign_id'=> 0,
|
||||
'United States'],
|
||||
['title'=>'You just Earned some token',
|
||||
'description'=>'This is the description of the description',
|
||||
'card_type'=>'TOKEN',
|
||||
'card_style' =>'card2',
|
||||
'card_icon' =>'icon1',
|
||||
'assign_id'=> 0,
|
||||
'United States']
|
||||
]
|
||||
];
|
||||
// $call_backend = false;
|
||||
|
||||
break;
|
||||
case 'sitecontact':
|
||||
$local_out = ['result'=>'100','msg'=>'Received'];
|
||||
$call_backend = false;
|
||||
break;
|
||||
case 'generics':
|
||||
case 'apigate':
|
||||
//$in["action"] = WRENCHBOARD_ACCOUNT_LOGIN;
|
||||
break;
|
||||
case 'startjoblist': $in["action"] = WRENCHBOARD_START_JOBLIST;
|
||||
if (!array_key_exists("limit",$in)) $in["limit"] = 10;
|
||||
if (!array_key_exists("page",$in)) $in["page"] = 1;
|
||||
break;
|
||||
|
||||
case 'createmobileuser': $in["action"] = WRENCHBOARD_CREATE_MOBILEUSER;
|
||||
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
||||
$in["news"] = 0;
|
||||
$in["terms"] = 1;
|
||||
$in["mobile"] = "MOBILE";
|
||||
break;
|
||||
case 'completemobileuser': $in["action"] = WRENCHBOARD_COMPLETE_MOBILEUSER;
|
||||
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
||||
break;
|
||||
|
||||
case 'startresetpasword':
|
||||
$in["action"] = WRENCHBOARD_RESET_PASSWORD;
|
||||
break;
|
||||
case 'createuser': $in["action"] = WRENCHBOARD_ACCOUNT_PENDING;
|
||||
$in["street1"] = $in["streetaddress"];
|
||||
$in["zipcode"] = $in["zip"];
|
||||
$in["country"] = "US";
|
||||
$in["loc"] = $_SERVER["REMOTE_ADDR"];
|
||||
$in["mobile"] = "MOBILE";
|
||||
break;
|
||||
case 'activejoblist': $in["action"] = WRENCHBOARD_MOBILE_ACTIVEJOB;
|
||||
break;
|
||||
case 'message': $in["action"] = WRENCHBOARD_MOBILE_MESSAGE;
|
||||
|
||||
break;
|
||||
case 'paymenthx': $in["action"] = WRENCHBOARD_MOBILE_PAYMENTHX;
|
||||
|
||||
break;
|
||||
case 'getjobsdata': $in["action"] = WRENCHBOARD_ACCOUNT_JOBLIST;
|
||||
break;
|
||||
|
||||
case 'userlogin': $in["action"] = WRENCHBOARD_ACCOUNT_LOGIN;
|
||||
$in["login_mode"] = MOBILE_LOGIN;
|
||||
break;
|
||||
|
||||
case 'dashdata': $in["action"] = WRENCHBOARD_ACCOUNT_DASHDATA;
|
||||
break;
|
||||
case 'offerslist': $in["action"] = WRENCHBOARD_MOBILE_OFFERSLIST;
|
||||
break;
|
||||
|
||||
case 'loadprofile': $in["action"] = WRENCHBOARD_MOBILE_LOADPROFILE;
|
||||
break;
|
||||
case 'account': $in["action"] = WRENCHBOARD_MOBILE_ACCOUNT;
|
||||
break;
|
||||
case 'getpendingjobs':
|
||||
$in["action"] = WRENCHBOARD_ACCOUNT_PENDJOB;
|
||||
break;
|
||||
case 'pendingjob':
|
||||
|
||||
break;
|
||||
case 'getjob':
|
||||
|
||||
break;
|
||||
|
||||
case 'mybanklist':$in["action"] = WRENCHBOARD_USER_GETBANKLIST;
|
||||
break;
|
||||
case 'sendmoney':$in["action"] = WRENCHBOARD_USER_SENDMONEY;
|
||||
$out["internal_return"] = 0;
|
||||
break;
|
||||
case 'sendinterest':$in["action"] = WRENCHBOARD_USER_SENDJOBINT;
|
||||
$out["internal_return"] = 0;
|
||||
break;
|
||||
case 'sendmoneyfee': $in["action"] = WRENCHBOARD_SMONEY_PROCFEE;
|
||||
break;
|
||||
case 'taskmessage': $in["action"] = WRENCHBOARD_MOBILE_TASKMESSAGE;
|
||||
break;
|
||||
case 'sendtaskmessage': $in["action"] = WRENCHBOARD_MOBILE_SENDTASKMESSAGE;
|
||||
break;
|
||||
|
||||
case 'getwallets': $in["action"] = WRENCHBOARD_ACCOUNT_WALLETS;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$in["pid"] = 100;
|
||||
|
||||
//file_put_contents("in_debug.log", $in); // DEBUG
|
||||
|
||||
$out = array();
|
||||
if ( $call_backend == true){
|
||||
$ret = $wrenchboard->wrenchboard_api($in, $out);
|
||||
$out['internal_return'] = $ret; // this is reserved array parameter - to be captured and received before you use the out array()
|
||||
}
|
||||
else
|
||||
{
|
||||
$out = $local_out;
|
||||
}
|
||||
|
||||
|
||||
header("HTTP/1.1 200 OK");
|
||||
header("Status: 200 OK");
|
||||
//$out = array_merge($in, $out); // DEBUG
|
||||
echo json_encode(processOutJson($in, $out));
|
||||
exit();
|
||||
|
||||
function flatten($data, $parentkey = "") {
|
||||
$result = array();
|
||||
foreach ($data as $key => $val) {
|
||||
if (is_array($val)) {
|
||||
$result = array_merge($result, flatten($val, $parentkey . $key . "_"));
|
||||
} else {
|
||||
$result[$parentkey . $key] = $val;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
// vi:ts=2
|
||||
@@ -0,0 +1,71 @@
|
||||
###################
|
||||
What is CodeIgniter
|
||||
###################
|
||||
|
||||
CodeIgniter is an Application Development Framework - a toolkit - for people
|
||||
who build web sites using PHP. Its goal is to enable you to develop projects
|
||||
much faster than you could if you were writing code from scratch, by providing
|
||||
a rich set of libraries for commonly needed tasks, as well as a simple
|
||||
interface and logical structure to access these libraries. CodeIgniter lets
|
||||
you creatively focus on your project by minimizing the amount of code needed
|
||||
for a given task.
|
||||
|
||||
*******************
|
||||
Release Information
|
||||
*******************
|
||||
|
||||
This repo contains in-development code for future releases. To download the
|
||||
latest stable release please visit the `CodeIgniter Downloads
|
||||
<https://codeigniter.com/download>`_ page.
|
||||
|
||||
**************************
|
||||
Changelog and New Features
|
||||
**************************
|
||||
|
||||
You can find a list of all changes for each release in the `user
|
||||
guide change log <https://github.com/bcit-ci/CodeIgniter/blob/develop/user_guide_src/source/changelog.rst>`_.
|
||||
|
||||
*******************
|
||||
Server Requirements
|
||||
*******************
|
||||
|
||||
PHP version 5.6 or newer is recommended.
|
||||
|
||||
It should work on 5.3.7 as well, but we strongly advise you NOT to run
|
||||
such old versions of PHP, because of potential security and performance
|
||||
issues, as well as missing features.
|
||||
|
||||
************
|
||||
Installation
|
||||
************
|
||||
|
||||
Please see the `installation section <https://codeigniter.com/userguide3/installation/index.html>`_
|
||||
of the CodeIgniter User Guide.
|
||||
|
||||
*******
|
||||
License
|
||||
*******
|
||||
|
||||
Please see the `license
|
||||
agreement <https://github.com/bcit-ci/CodeIgniter/blob/develop/user_guide_src/source/license.rst>`_.
|
||||
|
||||
*********
|
||||
Resources
|
||||
*********
|
||||
|
||||
- `User Guide <https://codeigniter.com/docs>`_
|
||||
- `Contributing Guide <https://github.com/bcit-ci/CodeIgniter/blob/develop/contributing.md>`_
|
||||
- `Language File Translations <https://github.com/bcit-ci/codeigniter3-translations>`_
|
||||
- `Community Forums <http://forum.codeigniter.com/>`_
|
||||
- `Community Wiki <https://github.com/bcit-ci/CodeIgniter/wiki>`_
|
||||
- `Community Slack Channel <https://codeigniterchat.slack.com>`_
|
||||
|
||||
Report security issues to our `Security Panel <mailto:security@codeigniter.com>`_
|
||||
or via our `page on HackerOne <https://hackerone.com/codeigniter>`_, thank you.
|
||||
|
||||
***************
|
||||
Acknowledgement
|
||||
***************
|
||||
|
||||
The CodeIgniter team would like to thank EllisLab, all the
|
||||
contributors to the CodeIgniter project and you, the CodeIgniter user.
|
||||
@@ -0,0 +1,6 @@
|
||||
<IfModule authz_core_module>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
<IfModule !authz_core_module>
|
||||
Deny from all
|
||||
</IfModule>
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Benchmark Class
|
||||
*
|
||||
* This class enables you to mark points and calculate the time difference
|
||||
* between them. Memory consumption can also be displayed.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/userguide3/libraries/benchmark.html
|
||||
*/
|
||||
class CI_Benchmark {
|
||||
|
||||
/**
|
||||
* List of all benchmark markers
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $marker = array();
|
||||
|
||||
/**
|
||||
* Set a benchmark marker
|
||||
*
|
||||
* Multiple calls to this function can be made so that several
|
||||
* execution points can be timed.
|
||||
*
|
||||
* @param string $name Marker name
|
||||
* @return void
|
||||
*/
|
||||
public function mark($name)
|
||||
{
|
||||
$this->marker[$name] = microtime(TRUE);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Elapsed time
|
||||
*
|
||||
* Calculates the time difference between two marked points.
|
||||
*
|
||||
* If the first parameter is empty this function instead returns the
|
||||
* {elapsed_time} pseudo-variable. This permits the full system
|
||||
* execution time to be shown in a template. The output class will
|
||||
* swap the real value for this variable.
|
||||
*
|
||||
* @param string $point1 A particular marked point
|
||||
* @param string $point2 A particular marked point
|
||||
* @param int $decimals Number of decimal places
|
||||
*
|
||||
* @return string Calculated elapsed time on success,
|
||||
* an '{elapsed_string}' if $point1 is empty
|
||||
* or an empty string if $point1 is not found.
|
||||
*/
|
||||
public function elapsed_time($point1 = '', $point2 = '', $decimals = 4)
|
||||
{
|
||||
if ($point1 === '')
|
||||
{
|
||||
return '{elapsed_time}';
|
||||
}
|
||||
|
||||
if ( ! isset($this->marker[$point1]))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( ! isset($this->marker[$point2]))
|
||||
{
|
||||
$this->marker[$point2] = microtime(TRUE);
|
||||
}
|
||||
|
||||
return number_format($this->marker[$point2] - $this->marker[$point1], $decimals);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Memory Usage
|
||||
*
|
||||
* Simply returns the {memory_usage} marker.
|
||||
*
|
||||
* This permits it to be put it anywhere in a template
|
||||
* without the memory being calculated until the end.
|
||||
* The output class will swap the real value for this variable.
|
||||
*
|
||||
* @return string '{memory_usage}'
|
||||
*/
|
||||
public function memory_usage()
|
||||
{
|
||||
return '{memory_usage}';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,560 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* System Initialization File
|
||||
*
|
||||
* Loads the base classes and executes the request.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage CodeIgniter
|
||||
* @category Front-controller
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/userguide3/
|
||||
*/
|
||||
|
||||
/**
|
||||
* CodeIgniter Version
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
*/
|
||||
const CI_VERSION = '3.1.13';
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Load the framework constants
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
|
||||
{
|
||||
require_once(APPPATH.'config/'.ENVIRONMENT.'/constants.php');
|
||||
}
|
||||
|
||||
if (file_exists(APPPATH.'config/constants.php'))
|
||||
{
|
||||
require_once(APPPATH.'config/constants.php');
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Load the global functions
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
require_once(BASEPATH.'core/Common.php');
|
||||
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Security procedures
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! is_php('5.4'))
|
||||
{
|
||||
ini_set('magic_quotes_runtime', 0);
|
||||
|
||||
if ((bool) ini_get('register_globals'))
|
||||
{
|
||||
$_protected = array(
|
||||
'_SERVER',
|
||||
'_GET',
|
||||
'_POST',
|
||||
'_FILES',
|
||||
'_REQUEST',
|
||||
'_SESSION',
|
||||
'_ENV',
|
||||
'_COOKIE',
|
||||
'GLOBALS',
|
||||
'HTTP_RAW_POST_DATA',
|
||||
'system_path',
|
||||
'application_folder',
|
||||
'view_folder',
|
||||
'_protected',
|
||||
'_registered'
|
||||
);
|
||||
|
||||
$_registered = ini_get('variables_order');
|
||||
foreach (array('E' => '_ENV', 'G' => '_GET', 'P' => '_POST', 'C' => '_COOKIE', 'S' => '_SERVER') as $key => $superglobal)
|
||||
{
|
||||
if (strpos($_registered, $key) === FALSE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (array_keys($$superglobal) as $var)
|
||||
{
|
||||
if (isset($GLOBALS[$var]) && ! in_array($var, $_protected, TRUE))
|
||||
{
|
||||
$GLOBALS[$var] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Define a custom error handler so we can log PHP errors
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
set_error_handler('_error_handler');
|
||||
set_exception_handler('_exception_handler');
|
||||
register_shutdown_function('_shutdown_handler');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Set the subclass_prefix
|
||||
* ------------------------------------------------------
|
||||
*
|
||||
* Normally the "subclass_prefix" is set in the config file.
|
||||
* The subclass prefix allows CI to know if a core class is
|
||||
* being extended via a library in the local application
|
||||
* "libraries" folder. Since CI allows config items to be
|
||||
* overridden via data set in the main index.php file,
|
||||
* before proceeding we need to know if a subclass_prefix
|
||||
* override exists. If so, we will set this value now,
|
||||
* before any classes are loaded
|
||||
* Note: Since the config file data is cached it doesn't
|
||||
* hurt to load it here.
|
||||
*/
|
||||
if ( ! empty($assign_to_config['subclass_prefix']))
|
||||
{
|
||||
get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Should we use a Composer autoloader?
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
if ($composer_autoload = config_item('composer_autoload'))
|
||||
{
|
||||
if ($composer_autoload === TRUE)
|
||||
{
|
||||
file_exists(APPPATH.'vendor/autoload.php')
|
||||
? require_once(APPPATH.'vendor/autoload.php')
|
||||
: log_message('error', '$config[\'composer_autoload\'] is set to TRUE but '.APPPATH.'vendor/autoload.php was not found.');
|
||||
}
|
||||
elseif (file_exists($composer_autoload))
|
||||
{
|
||||
require_once($composer_autoload);
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message('error', 'Could not find the specified $config[\'composer_autoload\'] path: '.$composer_autoload);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Start the timer... tick tock tick tock...
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$BM =& load_class('Benchmark', 'core');
|
||||
$BM->mark('total_execution_time_start');
|
||||
$BM->mark('loading_time:_base_classes_start');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Instantiate the hooks class
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$EXT =& load_class('Hooks', 'core');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Is there a "pre_system" hook?
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$EXT->call_hook('pre_system');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Instantiate the config class
|
||||
* ------------------------------------------------------
|
||||
*
|
||||
* Note: It is important that Config is loaded first as
|
||||
* most other classes depend on it either directly or by
|
||||
* depending on another class that uses it.
|
||||
*
|
||||
*/
|
||||
$CFG =& load_class('Config', 'core');
|
||||
|
||||
// Do we have any manually set config items in the index.php file?
|
||||
if (isset($assign_to_config) && is_array($assign_to_config))
|
||||
{
|
||||
foreach ($assign_to_config as $key => $value)
|
||||
{
|
||||
$CFG->set_item($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Important charset-related stuff
|
||||
* ------------------------------------------------------
|
||||
*
|
||||
* Configure mbstring and/or iconv if they are enabled
|
||||
* and set MB_ENABLED and ICONV_ENABLED constants, so
|
||||
* that we don't repeatedly do extension_loaded() or
|
||||
* function_exists() calls.
|
||||
*
|
||||
* Note: UTF-8 class depends on this. It used to be done
|
||||
* in it's constructor, but it's _not_ class-specific.
|
||||
*
|
||||
*/
|
||||
$charset = strtoupper(config_item('charset'));
|
||||
ini_set('default_charset', $charset);
|
||||
|
||||
if (extension_loaded('mbstring'))
|
||||
{
|
||||
define('MB_ENABLED', TRUE);
|
||||
// mbstring.internal_encoding is deprecated starting with PHP 5.6
|
||||
// and it's usage triggers E_DEPRECATED messages.
|
||||
@ini_set('mbstring.internal_encoding', $charset);
|
||||
// This is required for mb_convert_encoding() to strip invalid characters.
|
||||
// That's utilized by CI_Utf8, but it's also done for consistency with iconv.
|
||||
mb_substitute_character('none');
|
||||
}
|
||||
else
|
||||
{
|
||||
define('MB_ENABLED', FALSE);
|
||||
}
|
||||
|
||||
// There's an ICONV_IMPL constant, but the PHP manual says that using
|
||||
// iconv's predefined constants is "strongly discouraged".
|
||||
if (extension_loaded('iconv'))
|
||||
{
|
||||
define('ICONV_ENABLED', TRUE);
|
||||
// iconv.internal_encoding is deprecated starting with PHP 5.6
|
||||
// and it's usage triggers E_DEPRECATED messages.
|
||||
@ini_set('iconv.internal_encoding', $charset);
|
||||
}
|
||||
else
|
||||
{
|
||||
define('ICONV_ENABLED', FALSE);
|
||||
}
|
||||
|
||||
if (is_php('5.6'))
|
||||
{
|
||||
ini_set('php.internal_encoding', $charset);
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Load compatibility features
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
|
||||
require_once(BASEPATH.'core/compat/mbstring.php');
|
||||
require_once(BASEPATH.'core/compat/hash.php');
|
||||
require_once(BASEPATH.'core/compat/password.php');
|
||||
require_once(BASEPATH.'core/compat/standard.php');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Instantiate the UTF-8 class
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$UNI =& load_class('Utf8', 'core');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Instantiate the URI class
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$URI =& load_class('URI', 'core');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Instantiate the routing class and set the routing
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$RTR =& load_class('Router', 'core', isset($routing) ? $routing : NULL);
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Instantiate the output class
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$OUT =& load_class('Output', 'core');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Is there a valid cache file? If so, we're done...
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
if ($EXT->call_hook('cache_override') === FALSE && $OUT->_display_cache($CFG, $URI) === TRUE)
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------
|
||||
* Load the security class for xss and csrf support
|
||||
* -----------------------------------------------------
|
||||
*/
|
||||
$SEC =& load_class('Security', 'core');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Load the Input class and sanitize globals
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$IN =& load_class('Input', 'core');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Load the Language class
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$LANG =& load_class('Lang', 'core');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Load the app controller and local controller
|
||||
* ------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
// Load the base controller class
|
||||
require_once BASEPATH.'core/Controller.php';
|
||||
|
||||
/**
|
||||
* Reference to the CI_Controller method.
|
||||
*
|
||||
* Returns current CI instance object
|
||||
*
|
||||
* @return CI_Controller
|
||||
*/
|
||||
function &get_instance()
|
||||
{
|
||||
return CI_Controller::get_instance();
|
||||
}
|
||||
|
||||
if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php'))
|
||||
{
|
||||
require_once APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php';
|
||||
}
|
||||
|
||||
// Set a mark point for benchmarking
|
||||
$BM->mark('loading_time:_base_classes_end');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Sanity checks
|
||||
* ------------------------------------------------------
|
||||
*
|
||||
* The Router class has already validated the request,
|
||||
* leaving us with 3 options here:
|
||||
*
|
||||
* 1) an empty class name, if we reached the default
|
||||
* controller, but it didn't exist;
|
||||
* 2) a query string which doesn't go through a
|
||||
* file_exists() check
|
||||
* 3) a regular request for a non-existing page
|
||||
*
|
||||
* We handle all of these as a 404 error.
|
||||
*
|
||||
* Furthermore, none of the methods in the app controller
|
||||
* or the loader class can be called via the URI, nor can
|
||||
* controller methods that begin with an underscore.
|
||||
*/
|
||||
|
||||
$e404 = FALSE;
|
||||
$class = ucfirst($RTR->class);
|
||||
$method = $RTR->method;
|
||||
|
||||
if (empty($class) OR ! file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php'))
|
||||
{
|
||||
$e404 = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php');
|
||||
|
||||
if ( ! class_exists($class, FALSE) OR $method[0] === '_' OR method_exists('CI_Controller', $method))
|
||||
{
|
||||
$e404 = TRUE;
|
||||
}
|
||||
elseif (method_exists($class, '_remap'))
|
||||
{
|
||||
$params = array($method, array_slice($URI->rsegments, 2));
|
||||
$method = '_remap';
|
||||
}
|
||||
elseif ( ! method_exists($class, $method))
|
||||
{
|
||||
$e404 = TRUE;
|
||||
}
|
||||
/**
|
||||
* DO NOT CHANGE THIS, NOTHING ELSE WORKS!
|
||||
*
|
||||
* - method_exists() returns true for non-public methods, which passes the previous elseif
|
||||
* - is_callable() returns false for PHP 4-style constructors, even if there's a __construct()
|
||||
* - method_exists($class, '__construct') won't work because CI_Controller::__construct() is inherited
|
||||
* - People will only complain if this doesn't work, even though it is documented that it shouldn't.
|
||||
*
|
||||
* ReflectionMethod::isConstructor() is the ONLY reliable check,
|
||||
* knowing which method will be executed as a constructor.
|
||||
*/
|
||||
else
|
||||
{
|
||||
$reflection = new ReflectionMethod($class, $method);
|
||||
if ( ! $reflection->isPublic() OR $reflection->isConstructor())
|
||||
{
|
||||
$e404 = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($e404)
|
||||
{
|
||||
if ( ! empty($RTR->routes['404_override']))
|
||||
{
|
||||
if (sscanf($RTR->routes['404_override'], '%[^/]/%s', $error_class, $error_method) !== 2)
|
||||
{
|
||||
$error_method = 'index';
|
||||
}
|
||||
|
||||
$error_class = ucfirst($error_class);
|
||||
|
||||
if ( ! class_exists($error_class, FALSE))
|
||||
{
|
||||
if (file_exists(APPPATH.'controllers/'.$RTR->directory.$error_class.'.php'))
|
||||
{
|
||||
require_once(APPPATH.'controllers/'.$RTR->directory.$error_class.'.php');
|
||||
$e404 = ! class_exists($error_class, FALSE);
|
||||
}
|
||||
// Were we in a directory? If so, check for a global override
|
||||
elseif ( ! empty($RTR->directory) && file_exists(APPPATH.'controllers/'.$error_class.'.php'))
|
||||
{
|
||||
require_once(APPPATH.'controllers/'.$error_class.'.php');
|
||||
if (($e404 = ! class_exists($error_class, FALSE)) === FALSE)
|
||||
{
|
||||
$RTR->directory = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$e404 = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Did we reset the $e404 flag? If so, set the rsegments, starting from index 1
|
||||
if ( ! $e404)
|
||||
{
|
||||
$class = $error_class;
|
||||
$method = $error_method;
|
||||
|
||||
$URI->rsegments = array(
|
||||
1 => $class,
|
||||
2 => $method
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
show_404($RTR->directory.$class.'/'.$method);
|
||||
}
|
||||
}
|
||||
|
||||
if ($method !== '_remap')
|
||||
{
|
||||
$params = array_slice($URI->rsegments, 2);
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Is there a "pre_controller" hook?
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$EXT->call_hook('pre_controller');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Instantiate the requested controller
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
// Mark a start point so we can benchmark the controller
|
||||
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start');
|
||||
|
||||
$CI = new $class();
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Is there a "post_controller_constructor" hook?
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$EXT->call_hook('post_controller_constructor');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Call the requested method
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
call_user_func_array(array(&$CI, $method), $params);
|
||||
|
||||
// Mark a benchmark end point
|
||||
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Is there a "post_controller" hook?
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$EXT->call_hook('post_controller');
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Send the final rendered output to the browser
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
if ($EXT->call_hook('display_override') === FALSE)
|
||||
{
|
||||
$OUT->_display();
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------
|
||||
* Is there a "post_system" hook?
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
$EXT->call_hook('post_system');
|
||||
@@ -0,0 +1,849 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Common Functions
|
||||
*
|
||||
* Loads the base classes and executes the request.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage CodeIgniter
|
||||
* @category Common Functions
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/userguide3/
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('is_php'))
|
||||
{
|
||||
/**
|
||||
* Determines if the current version of PHP is equal to or greater than the supplied value
|
||||
*
|
||||
* @param string
|
||||
* @return bool TRUE if the current version is $version or higher
|
||||
*/
|
||||
function is_php($version)
|
||||
{
|
||||
static $_is_php;
|
||||
$version = (string) $version;
|
||||
|
||||
if ( ! isset($_is_php[$version]))
|
||||
{
|
||||
$_is_php[$version] = version_compare(PHP_VERSION, $version, '>=');
|
||||
}
|
||||
|
||||
return $_is_php[$version];
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('is_really_writable'))
|
||||
{
|
||||
/**
|
||||
* Tests for file writability
|
||||
*
|
||||
* is_writable() returns TRUE on Windows servers when you really can't write to
|
||||
* the file, based on the read-only attribute. is_writable() is also unreliable
|
||||
* on Unix servers if safe_mode is on.
|
||||
*
|
||||
* @link https://bugs.php.net/bug.php?id=54709
|
||||
* @param string
|
||||
* @return bool
|
||||
*/
|
||||
function is_really_writable($file)
|
||||
{
|
||||
// If we're on a Unix server with safe_mode off we call is_writable
|
||||
if (DIRECTORY_SEPARATOR === '/' && (is_php('5.4') OR ! ini_get('safe_mode')))
|
||||
{
|
||||
return is_writable($file);
|
||||
}
|
||||
|
||||
/* For Windows servers and safe_mode "on" installations we'll actually
|
||||
* write a file then read it. Bah...
|
||||
*/
|
||||
if (is_dir($file))
|
||||
{
|
||||
$file = rtrim($file, '/').'/'.md5(mt_rand());
|
||||
if (($fp = @fopen($file, 'ab')) === FALSE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
@chmod($file, 0777);
|
||||
@unlink($file);
|
||||
return TRUE;
|
||||
}
|
||||
elseif ( ! is_file($file) OR ($fp = @fopen($file, 'ab')) === FALSE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('load_class'))
|
||||
{
|
||||
/**
|
||||
* Class registry
|
||||
*
|
||||
* This function acts as a singleton. If the requested class does not
|
||||
* exist it is instantiated and set to a static variable. If it has
|
||||
* previously been instantiated the variable is returned.
|
||||
*
|
||||
* @param string the class name being requested
|
||||
* @param string the directory where the class should be found
|
||||
* @param mixed an optional argument to pass to the class constructor
|
||||
* @return object
|
||||
*/
|
||||
function &load_class($class, $directory = 'libraries', $param = NULL)
|
||||
{
|
||||
static $_classes = array();
|
||||
|
||||
// Does the class exist? If so, we're done...
|
||||
if (isset($_classes[$class]))
|
||||
{
|
||||
return $_classes[$class];
|
||||
}
|
||||
|
||||
$name = FALSE;
|
||||
|
||||
// Look for the class first in the local application/libraries folder
|
||||
// then in the native system/libraries folder
|
||||
foreach (array(APPPATH, BASEPATH) as $path)
|
||||
{
|
||||
if (file_exists($path.$directory.'/'.$class.'.php'))
|
||||
{
|
||||
$name = 'CI_'.$class;
|
||||
|
||||
if (class_exists($name, FALSE) === FALSE)
|
||||
{
|
||||
require_once($path.$directory.'/'.$class.'.php');
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Is the request a class extension? If so we load it too
|
||||
if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php'))
|
||||
{
|
||||
$name = config_item('subclass_prefix').$class;
|
||||
|
||||
if (class_exists($name, FALSE) === FALSE)
|
||||
{
|
||||
require_once(APPPATH.$directory.'/'.$name.'.php');
|
||||
}
|
||||
}
|
||||
|
||||
// Did we find the class?
|
||||
if ($name === FALSE)
|
||||
{
|
||||
// Note: We use exit() rather than show_error() in order to avoid a
|
||||
// self-referencing loop with the Exceptions class
|
||||
set_status_header(503);
|
||||
echo 'Unable to locate the specified class: '.$class.'.php';
|
||||
exit(5); // EXIT_UNK_CLASS
|
||||
}
|
||||
|
||||
// Keep track of what we just loaded
|
||||
is_loaded($class);
|
||||
|
||||
$_classes[$class] = isset($param)
|
||||
? new $name($param)
|
||||
: new $name();
|
||||
return $_classes[$class];
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('is_loaded'))
|
||||
{
|
||||
/**
|
||||
* Keeps track of which libraries have been loaded. This function is
|
||||
* called by the load_class() function above
|
||||
*
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
function &is_loaded($class = '')
|
||||
{
|
||||
static $_is_loaded = array();
|
||||
|
||||
if ($class !== '')
|
||||
{
|
||||
$_is_loaded[strtolower($class)] = $class;
|
||||
}
|
||||
|
||||
return $_is_loaded;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('get_config'))
|
||||
{
|
||||
/**
|
||||
* Loads the main config.php file
|
||||
*
|
||||
* This function lets us grab the config file even if the Config class
|
||||
* hasn't been instantiated yet
|
||||
*
|
||||
* @param array
|
||||
* @return array
|
||||
*/
|
||||
function &get_config(Array $replace = array())
|
||||
{
|
||||
static $config;
|
||||
|
||||
if (empty($config))
|
||||
{
|
||||
$file_path = APPPATH.'config/config.php';
|
||||
$found = FALSE;
|
||||
if (file_exists($file_path))
|
||||
{
|
||||
$found = TRUE;
|
||||
require($file_path);
|
||||
}
|
||||
|
||||
// Is the config file in the environment folder?
|
||||
if (file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php'))
|
||||
{
|
||||
require($file_path);
|
||||
}
|
||||
elseif ( ! $found)
|
||||
{
|
||||
set_status_header(503);
|
||||
echo 'The configuration file does not exist.';
|
||||
exit(3); // EXIT_CONFIG
|
||||
}
|
||||
|
||||
// Does the $config array exist in the file?
|
||||
if ( ! isset($config) OR ! is_array($config))
|
||||
{
|
||||
set_status_header(503);
|
||||
echo 'Your config file does not appear to be formatted correctly.';
|
||||
exit(3); // EXIT_CONFIG
|
||||
}
|
||||
}
|
||||
|
||||
// Are any values being dynamically added or replaced?
|
||||
foreach ($replace as $key => $val)
|
||||
{
|
||||
$config[$key] = $val;
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('config_item'))
|
||||
{
|
||||
/**
|
||||
* Returns the specified config item
|
||||
*
|
||||
* @param string
|
||||
* @return mixed
|
||||
*/
|
||||
function config_item($item)
|
||||
{
|
||||
static $_config;
|
||||
|
||||
if (empty($_config))
|
||||
{
|
||||
// references cannot be directly assigned to static variables, so we use an array
|
||||
$_config[0] =& get_config();
|
||||
}
|
||||
|
||||
return isset($_config[0][$item]) ? $_config[0][$item] : NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('get_mimes'))
|
||||
{
|
||||
/**
|
||||
* Returns the MIME types array from config/mimes.php
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function &get_mimes()
|
||||
{
|
||||
static $_mimes;
|
||||
|
||||
if (empty($_mimes))
|
||||
{
|
||||
$_mimes = file_exists(APPPATH.'config/mimes.php')
|
||||
? include(APPPATH.'config/mimes.php')
|
||||
: array();
|
||||
|
||||
if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
|
||||
{
|
||||
$_mimes = array_merge($_mimes, include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'));
|
||||
}
|
||||
}
|
||||
|
||||
return $_mimes;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('is_https'))
|
||||
{
|
||||
/**
|
||||
* Is HTTPS?
|
||||
*
|
||||
* Determines if the application is accessed via an encrypted
|
||||
* (HTTPS) connection.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_https()
|
||||
{
|
||||
if ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off')
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https')
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
elseif ( ! empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off')
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('is_cli'))
|
||||
{
|
||||
|
||||
/**
|
||||
* Is CLI?
|
||||
*
|
||||
* Test to see if a request was made from the command line.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_cli()
|
||||
{
|
||||
return (PHP_SAPI === 'cli' OR defined('STDIN'));
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('show_error'))
|
||||
{
|
||||
/**
|
||||
* Error Handler
|
||||
*
|
||||
* This function lets us invoke the exception class and
|
||||
* display errors using the standard error template located
|
||||
* in application/views/errors/error_general.php
|
||||
* This function will send the error page directly to the
|
||||
* browser and exit.
|
||||
*
|
||||
* @param string
|
||||
* @param int
|
||||
* @param string
|
||||
* @return void
|
||||
*/
|
||||
function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered')
|
||||
{
|
||||
$status_code = abs($status_code);
|
||||
if ($status_code < 100)
|
||||
{
|
||||
$exit_status = $status_code + 9; // 9 is EXIT__AUTO_MIN
|
||||
$status_code = 500;
|
||||
}
|
||||
else
|
||||
{
|
||||
$exit_status = 1; // EXIT_ERROR
|
||||
}
|
||||
|
||||
$_error =& load_class('Exceptions', 'core');
|
||||
echo $_error->show_error($heading, $message, 'error_general', $status_code);
|
||||
exit($exit_status);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('show_404'))
|
||||
{
|
||||
/**
|
||||
* 404 Page Handler
|
||||
*
|
||||
* This function is similar to the show_error() function above
|
||||
* However, instead of the standard error template it displays
|
||||
* 404 errors.
|
||||
*
|
||||
* @param string
|
||||
* @param bool
|
||||
* @return void
|
||||
*/
|
||||
function show_404($page = '', $log_error = TRUE)
|
||||
{
|
||||
$_error =& load_class('Exceptions', 'core');
|
||||
$_error->show_404($page, $log_error);
|
||||
exit(4); // EXIT_UNKNOWN_FILE
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('log_message'))
|
||||
{
|
||||
/**
|
||||
* Error Logging Interface
|
||||
*
|
||||
* We use this as a simple mechanism to access the logging
|
||||
* class and send messages to be logged.
|
||||
*
|
||||
* @param string the error level: 'error', 'debug' or 'info'
|
||||
* @param string the error message
|
||||
* @return void
|
||||
*/
|
||||
function log_message($level, $message)
|
||||
{
|
||||
static $_log;
|
||||
|
||||
if ($_log === NULL)
|
||||
{
|
||||
// references cannot be directly assigned to static variables, so we use an array
|
||||
$_log[0] =& load_class('Log', 'core');
|
||||
}
|
||||
|
||||
$_log[0]->write_log($level, $message);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('set_status_header'))
|
||||
{
|
||||
/**
|
||||
* Set HTTP Status Header
|
||||
*
|
||||
* @param int the status code
|
||||
* @param string
|
||||
* @return void
|
||||
*/
|
||||
function set_status_header($code = 200, $text = '')
|
||||
{
|
||||
if (is_cli())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($code) OR ! is_numeric($code))
|
||||
{
|
||||
show_error('Status codes must be numeric', 500);
|
||||
}
|
||||
|
||||
if (empty($text))
|
||||
{
|
||||
is_int($code) OR $code = (int) $code;
|
||||
$stati = array(
|
||||
100 => 'Continue',
|
||||
101 => 'Switching Protocols',
|
||||
|
||||
200 => 'OK',
|
||||
201 => 'Created',
|
||||
202 => 'Accepted',
|
||||
203 => 'Non-Authoritative Information',
|
||||
204 => 'No Content',
|
||||
205 => 'Reset Content',
|
||||
206 => 'Partial Content',
|
||||
|
||||
300 => 'Multiple Choices',
|
||||
301 => 'Moved Permanently',
|
||||
302 => 'Found',
|
||||
303 => 'See Other',
|
||||
304 => 'Not Modified',
|
||||
305 => 'Use Proxy',
|
||||
307 => 'Temporary Redirect',
|
||||
|
||||
400 => 'Bad Request',
|
||||
401 => 'Unauthorized',
|
||||
402 => 'Payment Required',
|
||||
403 => 'Forbidden',
|
||||
404 => 'Not Found',
|
||||
405 => 'Method Not Allowed',
|
||||
406 => 'Not Acceptable',
|
||||
407 => 'Proxy Authentication Required',
|
||||
408 => 'Request Timeout',
|
||||
409 => 'Conflict',
|
||||
410 => 'Gone',
|
||||
411 => 'Length Required',
|
||||
412 => 'Precondition Failed',
|
||||
413 => 'Request Entity Too Large',
|
||||
414 => 'Request-URI Too Long',
|
||||
415 => 'Unsupported Media Type',
|
||||
416 => 'Requested Range Not Satisfiable',
|
||||
417 => 'Expectation Failed',
|
||||
422 => 'Unprocessable Entity',
|
||||
426 => 'Upgrade Required',
|
||||
428 => 'Precondition Required',
|
||||
429 => 'Too Many Requests',
|
||||
431 => 'Request Header Fields Too Large',
|
||||
|
||||
500 => 'Internal Server Error',
|
||||
501 => 'Not Implemented',
|
||||
502 => 'Bad Gateway',
|
||||
503 => 'Service Unavailable',
|
||||
504 => 'Gateway Timeout',
|
||||
505 => 'HTTP Version Not Supported',
|
||||
511 => 'Network Authentication Required',
|
||||
);
|
||||
|
||||
if (isset($stati[$code]))
|
||||
{
|
||||
$text = $stati[$code];
|
||||
}
|
||||
else
|
||||
{
|
||||
show_error('No status text available. Please check your status code number or supply your own message text.', 500);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos(PHP_SAPI, 'cgi') === 0)
|
||||
{
|
||||
header('Status: '.$code.' '.$text, TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
$server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0'), TRUE))
|
||||
? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
|
||||
header($server_protocol.' '.$code.' '.$text, TRUE, $code);
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('_error_handler'))
|
||||
{
|
||||
/**
|
||||
* Error Handler
|
||||
*
|
||||
* This is the custom error handler that is declared at the (relative)
|
||||
* top of CodeIgniter.php. The main reason we use this is to permit
|
||||
* PHP errors to be logged in our own log files since the user may
|
||||
* not have access to server logs. Since this function effectively
|
||||
* intercepts PHP errors, however, we also need to display errors
|
||||
* based on the current error_reporting level.
|
||||
* We do that with the use of a PHP error template.
|
||||
*
|
||||
* @param int $severity
|
||||
* @param string $message
|
||||
* @param string $filepath
|
||||
* @param int $line
|
||||
* @return void
|
||||
*/
|
||||
function _error_handler($severity, $message, $filepath, $line)
|
||||
{
|
||||
$is_error = (((E_ERROR | E_PARSE | E_COMPILE_ERROR | E_CORE_ERROR | E_USER_ERROR) & $severity) === $severity);
|
||||
|
||||
// When an error occurred, set the status header to '500 Internal Server Error'
|
||||
// to indicate to the client something went wrong.
|
||||
// This can't be done within the $_error->show_php_error method because
|
||||
// it is only called when the display_errors flag is set (which isn't usually
|
||||
// the case in a production environment) or when errors are ignored because
|
||||
// they are above the error_reporting threshold.
|
||||
if ($is_error)
|
||||
{
|
||||
set_status_header(500);
|
||||
}
|
||||
|
||||
// Should we ignore the error? We'll get the current error_reporting
|
||||
// level and add its bits with the severity bits to find out.
|
||||
if (($severity & error_reporting()) !== $severity)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$_error =& load_class('Exceptions', 'core');
|
||||
$_error->log_exception($severity, $message, $filepath, $line);
|
||||
|
||||
// Should we display the error?
|
||||
if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors')))
|
||||
{
|
||||
$_error->show_php_error($severity, $message, $filepath, $line);
|
||||
}
|
||||
|
||||
// If the error is fatal, the execution of the script should be stopped because
|
||||
// errors can't be recovered from. Halting the script conforms with PHP's
|
||||
// default error handling. See http://www.php.net/manual/en/errorfunc.constants.php
|
||||
if ($is_error)
|
||||
{
|
||||
exit(1); // EXIT_ERROR
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('_exception_handler'))
|
||||
{
|
||||
/**
|
||||
* Exception Handler
|
||||
*
|
||||
* Sends uncaught exceptions to the logger and displays them
|
||||
* only if display_errors is On so that they don't show up in
|
||||
* production environments.
|
||||
*
|
||||
* @param Exception $exception
|
||||
* @return void
|
||||
*/
|
||||
function _exception_handler($exception)
|
||||
{
|
||||
$_error =& load_class('Exceptions', 'core');
|
||||
$_error->log_exception('error', 'Exception: '.$exception->getMessage(), $exception->getFile(), $exception->getLine());
|
||||
|
||||
is_cli() OR set_status_header(500);
|
||||
// Should we display the error?
|
||||
if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors')))
|
||||
{
|
||||
$_error->show_exception($exception);
|
||||
}
|
||||
|
||||
exit(1); // EXIT_ERROR
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('_shutdown_handler'))
|
||||
{
|
||||
/**
|
||||
* Shutdown Handler
|
||||
*
|
||||
* This is the shutdown handler that is declared at the top
|
||||
* of CodeIgniter.php. The main reason we use this is to simulate
|
||||
* a complete custom exception handler.
|
||||
*
|
||||
* E_STRICT is purposively neglected because such events may have
|
||||
* been caught. Duplication or none? None is preferred for now.
|
||||
*
|
||||
* @link http://insomanic.me.uk/post/229851073/php-trick-catching-fatal-errors-e-error-with-a
|
||||
* @return void
|
||||
*/
|
||||
function _shutdown_handler()
|
||||
{
|
||||
$last_error = error_get_last();
|
||||
if (isset($last_error) &&
|
||||
($last_error['type'] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING)))
|
||||
{
|
||||
_error_handler($last_error['type'], $last_error['message'], $last_error['file'], $last_error['line']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('remove_invisible_characters'))
|
||||
{
|
||||
/**
|
||||
* Remove Invisible Characters
|
||||
*
|
||||
* This prevents sandwiching null characters
|
||||
* between ascii characters, like Java\0script.
|
||||
*
|
||||
* @param string
|
||||
* @param bool
|
||||
* @return string
|
||||
*/
|
||||
function remove_invisible_characters($str, $url_encoded = TRUE)
|
||||
{
|
||||
$non_displayables = array();
|
||||
|
||||
// every control character except newline (dec 10),
|
||||
// carriage return (dec 13) and horizontal tab (dec 09)
|
||||
if ($url_encoded)
|
||||
{
|
||||
$non_displayables[] = '/%0[0-8bcef]/i'; // url encoded 00-08, 11, 12, 14, 15
|
||||
$non_displayables[] = '/%1[0-9a-f]/i'; // url encoded 16-31
|
||||
$non_displayables[] = '/%7f/i'; // url encoded 127
|
||||
}
|
||||
|
||||
$non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127
|
||||
|
||||
do
|
||||
{
|
||||
$str = preg_replace($non_displayables, '', $str, -1, $count);
|
||||
}
|
||||
while ($count);
|
||||
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('html_escape'))
|
||||
{
|
||||
/**
|
||||
* Returns HTML escaped variable.
|
||||
*
|
||||
* @param mixed $var The input string or array of strings to be escaped.
|
||||
* @param bool $double_encode $double_encode set to FALSE prevents escaping twice.
|
||||
* @return mixed The escaped string or array of strings as a result.
|
||||
*/
|
||||
function html_escape($var, $double_encode = TRUE)
|
||||
{
|
||||
if (empty($var))
|
||||
{
|
||||
return $var;
|
||||
}
|
||||
|
||||
if (is_array($var))
|
||||
{
|
||||
foreach (array_keys($var) as $key)
|
||||
{
|
||||
$var[$key] = html_escape($var[$key], $double_encode);
|
||||
}
|
||||
|
||||
return $var;
|
||||
}
|
||||
|
||||
return htmlspecialchars($var, ENT_QUOTES, config_item('charset'), $double_encode);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('_stringify_attributes'))
|
||||
{
|
||||
/**
|
||||
* Stringify attributes for use in HTML tags.
|
||||
*
|
||||
* Helper function used to convert a string, array, or object
|
||||
* of attributes to a string.
|
||||
*
|
||||
* @param mixed string, array, object
|
||||
* @param bool
|
||||
* @return string
|
||||
*/
|
||||
function _stringify_attributes($attributes, $js = FALSE)
|
||||
{
|
||||
if (empty($attributes))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (is_string($attributes))
|
||||
{
|
||||
return ' '.$attributes;
|
||||
}
|
||||
|
||||
$attributes = (array) $attributes;
|
||||
|
||||
$atts = '';
|
||||
foreach ($attributes as $key => $val)
|
||||
{
|
||||
$atts .= ($js) ? $key.'='.$val.',' : ' '.$key.'="'.$val.'"';
|
||||
}
|
||||
|
||||
return rtrim($atts, ',');
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('function_usable'))
|
||||
{
|
||||
/**
|
||||
* Function usable
|
||||
*
|
||||
* Executes a function_exists() check, and if the Suhosin PHP
|
||||
* extension is loaded - checks whether the function that is
|
||||
* checked might be disabled in there as well.
|
||||
*
|
||||
* This is useful as function_exists() will return FALSE for
|
||||
* functions disabled via the *disable_functions* php.ini
|
||||
* setting, but not for *suhosin.executor.func.blacklist* and
|
||||
* *suhosin.executor.disable_eval*. These settings will just
|
||||
* terminate script execution if a disabled function is executed.
|
||||
*
|
||||
* The above described behavior turned out to be a bug in Suhosin,
|
||||
* but even though a fix was committed for 0.9.34 on 2012-02-12,
|
||||
* that version is yet to be released. This function will therefore
|
||||
* be just temporary, but would probably be kept for a few years.
|
||||
*
|
||||
* @link http://www.hardened-php.net/suhosin/
|
||||
* @param string $function_name Function to check for
|
||||
* @return bool TRUE if the function exists and is safe to call,
|
||||
* FALSE otherwise.
|
||||
*/
|
||||
function function_usable($function_name)
|
||||
{
|
||||
static $_suhosin_func_blacklist;
|
||||
|
||||
if (function_exists($function_name))
|
||||
{
|
||||
if ( ! isset($_suhosin_func_blacklist))
|
||||
{
|
||||
$_suhosin_func_blacklist = extension_loaded('suhosin')
|
||||
? explode(',', trim(ini_get('suhosin.executor.func.blacklist')))
|
||||
: array();
|
||||
}
|
||||
|
||||
return ! in_array($function_name, $_suhosin_func_blacklist, TRUE);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,380 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Config Class
|
||||
*
|
||||
* This class contains functions that enable config files to be managed
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/userguide3/libraries/config.html
|
||||
*/
|
||||
class CI_Config {
|
||||
|
||||
/**
|
||||
* List of all loaded config values
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $config = array();
|
||||
|
||||
/**
|
||||
* List of all loaded config files
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $is_loaded = array();
|
||||
|
||||
/**
|
||||
* List of paths to search when trying to load a config file.
|
||||
*
|
||||
* @used-by CI_Loader
|
||||
* @var array
|
||||
*/
|
||||
public $_config_paths = array(APPPATH);
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* Sets the $config data from the primary config.php file as a class variable.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->config =& get_config();
|
||||
|
||||
// Set the base_url automatically if none was provided
|
||||
if (empty($this->config['base_url']))
|
||||
{
|
||||
if (isset($_SERVER['SERVER_ADDR']))
|
||||
{
|
||||
if (strpos($_SERVER['SERVER_ADDR'], ':') !== FALSE)
|
||||
{
|
||||
$server_addr = '['.$_SERVER['SERVER_ADDR'].']';
|
||||
}
|
||||
else
|
||||
{
|
||||
$server_addr = $_SERVER['SERVER_ADDR'];
|
||||
}
|
||||
|
||||
$base_url = (is_https() ? 'https' : 'http').'://'.$server_addr
|
||||
.substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME'])));
|
||||
}
|
||||
else
|
||||
{
|
||||
$base_url = 'http://localhost/';
|
||||
}
|
||||
|
||||
$this->set_item('base_url', $base_url);
|
||||
}
|
||||
|
||||
log_message('info', 'Config Class Initialized');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Load Config File
|
||||
*
|
||||
* @param string $file Configuration file name
|
||||
* @param bool $use_sections Whether configuration values should be loaded into their own section
|
||||
* @param bool $fail_gracefully Whether to just return FALSE or display an error message
|
||||
* @return bool TRUE if the file was loaded correctly or FALSE on failure
|
||||
*/
|
||||
public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
|
||||
{
|
||||
$file = ($file === '') ? 'config' : str_replace('.php', '', $file);
|
||||
$loaded = FALSE;
|
||||
|
||||
foreach ($this->_config_paths as $path)
|
||||
{
|
||||
foreach (array($file, ENVIRONMENT.DIRECTORY_SEPARATOR.$file) as $location)
|
||||
{
|
||||
$file_path = $path.'config/'.$location.'.php';
|
||||
if (in_array($file_path, $this->is_loaded, TRUE))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ( ! file_exists($file_path))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
include($file_path);
|
||||
|
||||
if ( ! isset($config) OR ! is_array($config))
|
||||
{
|
||||
if ($fail_gracefully === TRUE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
show_error('Your '.$file_path.' file does not appear to contain a valid configuration array.');
|
||||
}
|
||||
|
||||
if ($use_sections === TRUE)
|
||||
{
|
||||
$this->config[$file] = isset($this->config[$file])
|
||||
? array_merge($this->config[$file], $config)
|
||||
: $config;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->config = array_merge($this->config, $config);
|
||||
}
|
||||
|
||||
$this->is_loaded[] = $file_path;
|
||||
$config = NULL;
|
||||
$loaded = TRUE;
|
||||
log_message('debug', 'Config file loaded: '.$file_path);
|
||||
}
|
||||
}
|
||||
|
||||
if ($loaded === TRUE)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
elseif ($fail_gracefully === TRUE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
show_error('The configuration file '.$file.'.php does not exist.');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch a config file item
|
||||
*
|
||||
* @param string $item Config item name
|
||||
* @param string $index Index name
|
||||
* @return string|null The configuration item or NULL if the item doesn't exist
|
||||
*/
|
||||
public function item($item, $index = '')
|
||||
{
|
||||
if ($index == '')
|
||||
{
|
||||
return isset($this->config[$item]) ? $this->config[$item] : NULL;
|
||||
}
|
||||
|
||||
return isset($this->config[$index], $this->config[$index][$item]) ? $this->config[$index][$item] : NULL;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch a config file item with slash appended (if not empty)
|
||||
*
|
||||
* @param string $item Config item name
|
||||
* @return string|null The configuration item or NULL if the item doesn't exist
|
||||
*/
|
||||
public function slash_item($item)
|
||||
{
|
||||
if ( ! isset($this->config[$item]))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
elseif (trim($this->config[$item]) === '')
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
return rtrim($this->config[$item], '/').'/';
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Site URL
|
||||
*
|
||||
* Returns base_url . index_page [. uri_string]
|
||||
*
|
||||
* @uses CI_Config::_uri_string()
|
||||
*
|
||||
* @param string|string[] $uri URI string or an array of segments
|
||||
* @param string $protocol
|
||||
* @return string
|
||||
*/
|
||||
public function site_url($uri = '', $protocol = NULL)
|
||||
{
|
||||
$base_url = $this->slash_item('base_url');
|
||||
|
||||
if (isset($protocol))
|
||||
{
|
||||
// For protocol-relative links
|
||||
if ($protocol === '')
|
||||
{
|
||||
$base_url = substr($base_url, strpos($base_url, '//'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$base_url = $protocol.substr($base_url, strpos($base_url, '://'));
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($uri))
|
||||
{
|
||||
return $base_url.$this->item('index_page');
|
||||
}
|
||||
|
||||
$uri = $this->_uri_string($uri);
|
||||
|
||||
if ($this->item('enable_query_strings') === FALSE)
|
||||
{
|
||||
$suffix = isset($this->config['url_suffix']) ? $this->config['url_suffix'] : '';
|
||||
|
||||
if ($suffix !== '')
|
||||
{
|
||||
if (($offset = strpos($uri, '?')) !== FALSE)
|
||||
{
|
||||
$uri = substr($uri, 0, $offset).$suffix.substr($uri, $offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
$uri .= $suffix;
|
||||
}
|
||||
}
|
||||
|
||||
return $base_url.$this->slash_item('index_page').$uri;
|
||||
}
|
||||
elseif (strpos($uri, '?') === FALSE)
|
||||
{
|
||||
$uri = '?'.$uri;
|
||||
}
|
||||
|
||||
return $base_url.$this->item('index_page').$uri;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Base URL
|
||||
*
|
||||
* Returns base_url [. uri_string]
|
||||
*
|
||||
* @uses CI_Config::_uri_string()
|
||||
*
|
||||
* @param string|string[] $uri URI string or an array of segments
|
||||
* @param string $protocol
|
||||
* @return string
|
||||
*/
|
||||
public function base_url($uri = '', $protocol = NULL)
|
||||
{
|
||||
$base_url = $this->slash_item('base_url');
|
||||
|
||||
if (isset($protocol))
|
||||
{
|
||||
// For protocol-relative links
|
||||
if ($protocol === '')
|
||||
{
|
||||
$base_url = substr($base_url, strpos($base_url, '//'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$base_url = $protocol.substr($base_url, strpos($base_url, '://'));
|
||||
}
|
||||
}
|
||||
|
||||
return $base_url.$this->_uri_string($uri);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Build URI string
|
||||
*
|
||||
* @used-by CI_Config::site_url()
|
||||
* @used-by CI_Config::base_url()
|
||||
*
|
||||
* @param string|string[] $uri URI string or an array of segments
|
||||
* @return string
|
||||
*/
|
||||
protected function _uri_string($uri)
|
||||
{
|
||||
if ($this->item('enable_query_strings') === FALSE)
|
||||
{
|
||||
is_array($uri) && $uri = implode('/', $uri);
|
||||
return ltrim($uri, '/');
|
||||
}
|
||||
elseif (is_array($uri))
|
||||
{
|
||||
return http_build_query($uri);
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* System URL
|
||||
*
|
||||
* @deprecated 3.0.0 Encourages insecure practices
|
||||
* @return string
|
||||
*/
|
||||
public function system_url()
|
||||
{
|
||||
$x = explode('/', preg_replace('|/*(.+?)/*$|', '\\1', BASEPATH));
|
||||
return $this->slash_item('base_url').end($x).'/';
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set a config file item
|
||||
*
|
||||
* @param string $item Config item key
|
||||
* @param string $value Config item value
|
||||
* @return void
|
||||
*/
|
||||
public function set_item($item, $value)
|
||||
{
|
||||
$this->config[$item] = $value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Application Controller Class
|
||||
*
|
||||
* This class object is the super class that every library in
|
||||
* CodeIgniter will be assigned to.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/userguide3/general/controllers.html
|
||||
*/
|
||||
class CI_Controller {
|
||||
|
||||
/**
|
||||
* Reference to the CI singleton
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* CI_Loader
|
||||
*
|
||||
* @var CI_Loader
|
||||
*/
|
||||
public $load;
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
self::$instance =& $this;
|
||||
|
||||
// Assign all the class objects that were instantiated by the
|
||||
// bootstrap file (CodeIgniter.php) to local class variables
|
||||
// so that CI can run as one big super object.
|
||||
foreach (is_loaded() as $var => $class)
|
||||
{
|
||||
$this->$var =& load_class($class);
|
||||
}
|
||||
|
||||
$this->load =& load_class('Loader', 'core');
|
||||
$this->load->initialize();
|
||||
log_message('info', 'Controller Class Initialized');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get the CI singleton
|
||||
*
|
||||
* @static
|
||||
* @return object
|
||||
*/
|
||||
public static function &get_instance()
|
||||
{
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,275 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Exceptions Class
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Libraries
|
||||
* @category Exceptions
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/userguide3/libraries/exceptions.html
|
||||
*/
|
||||
class CI_Exceptions {
|
||||
|
||||
/**
|
||||
* Nesting level of the output buffering mechanism
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $ob_level;
|
||||
|
||||
/**
|
||||
* List of available error levels
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $levels = array(
|
||||
E_ERROR => 'Error',
|
||||
E_WARNING => 'Warning',
|
||||
E_PARSE => 'Parsing Error',
|
||||
E_NOTICE => 'Notice',
|
||||
E_CORE_ERROR => 'Core Error',
|
||||
E_CORE_WARNING => 'Core Warning',
|
||||
E_COMPILE_ERROR => 'Compile Error',
|
||||
E_COMPILE_WARNING => 'Compile Warning',
|
||||
E_USER_ERROR => 'User Error',
|
||||
E_USER_WARNING => 'User Warning',
|
||||
E_USER_NOTICE => 'User Notice',
|
||||
E_STRICT => 'Runtime Notice'
|
||||
);
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->ob_level = ob_get_level();
|
||||
// Note: Do not log messages from this constructor.
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Exception Logger
|
||||
*
|
||||
* Logs PHP generated error messages
|
||||
*
|
||||
* @param int $severity Log level
|
||||
* @param string $message Error message
|
||||
* @param string $filepath File path
|
||||
* @param int $line Line number
|
||||
* @return void
|
||||
*/
|
||||
public function log_exception($severity, $message, $filepath, $line)
|
||||
{
|
||||
$severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity;
|
||||
log_message('error', 'Severity: '.$severity.' --> '.$message.' '.$filepath.' '.$line);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 404 Error Handler
|
||||
*
|
||||
* @uses CI_Exceptions::show_error()
|
||||
*
|
||||
* @param string $page Page URI
|
||||
* @param bool $log_error Whether to log the error
|
||||
* @return void
|
||||
*/
|
||||
public function show_404($page = '', $log_error = TRUE)
|
||||
{
|
||||
if (is_cli())
|
||||
{
|
||||
$heading = 'Not Found';
|
||||
$message = 'The controller/method pair you requested was not found.';
|
||||
}
|
||||
else
|
||||
{
|
||||
$heading = '404 Page Not Found';
|
||||
$message = 'The page you requested was not found.';
|
||||
}
|
||||
|
||||
// By default we log this, but allow a dev to skip it
|
||||
if ($log_error)
|
||||
{
|
||||
log_message('error', $heading.': '.$page);
|
||||
}
|
||||
|
||||
echo $this->show_error($heading, $message, 'error_404', 404);
|
||||
exit(4); // EXIT_UNKNOWN_FILE
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* General Error Page
|
||||
*
|
||||
* Takes an error message as input (either as a string or an array)
|
||||
* and displays it using the specified template.
|
||||
*
|
||||
* @param string $heading Page heading
|
||||
* @param string|string[] $message Error message
|
||||
* @param string $template Template name
|
||||
* @param int $status_code (default: 500)
|
||||
*
|
||||
* @return string Error page output
|
||||
*/
|
||||
public function show_error($heading, $message, $template = 'error_general', $status_code = 500)
|
||||
{
|
||||
$templates_path = config_item('error_views_path');
|
||||
if (empty($templates_path))
|
||||
{
|
||||
$templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
if (is_cli())
|
||||
{
|
||||
$message = "\t".(is_array($message) ? implode("\n\t", $message) : $message);
|
||||
$template = 'cli'.DIRECTORY_SEPARATOR.$template;
|
||||
}
|
||||
else
|
||||
{
|
||||
set_status_header($status_code);
|
||||
$message = '<p>'.(is_array($message) ? implode('</p><p>', $message) : $message).'</p>';
|
||||
$template = 'html'.DIRECTORY_SEPARATOR.$template;
|
||||
}
|
||||
|
||||
if (ob_get_level() > $this->ob_level + 1)
|
||||
{
|
||||
ob_end_flush();
|
||||
}
|
||||
ob_start();
|
||||
include($templates_path.$template.'.php');
|
||||
$buffer = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
public function show_exception($exception)
|
||||
{
|
||||
$templates_path = config_item('error_views_path');
|
||||
if (empty($templates_path))
|
||||
{
|
||||
$templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
$message = $exception->getMessage();
|
||||
if (empty($message))
|
||||
{
|
||||
$message = '(null)';
|
||||
}
|
||||
|
||||
if (is_cli())
|
||||
{
|
||||
$templates_path .= 'cli'.DIRECTORY_SEPARATOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
$templates_path .= 'html'.DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
if (ob_get_level() > $this->ob_level + 1)
|
||||
{
|
||||
ob_end_flush();
|
||||
}
|
||||
|
||||
ob_start();
|
||||
include($templates_path.'error_exception.php');
|
||||
$buffer = ob_get_contents();
|
||||
ob_end_clean();
|
||||
echo $buffer;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Native PHP error handler
|
||||
*
|
||||
* @param int $severity Error level
|
||||
* @param string $message Error message
|
||||
* @param string $filepath File path
|
||||
* @param int $line Line number
|
||||
* @return void
|
||||
*/
|
||||
public function show_php_error($severity, $message, $filepath, $line)
|
||||
{
|
||||
$templates_path = config_item('error_views_path');
|
||||
if (empty($templates_path))
|
||||
{
|
||||
$templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
$severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity;
|
||||
|
||||
// For safety reasons we don't show the full file path in non-CLI requests
|
||||
if ( ! is_cli())
|
||||
{
|
||||
$filepath = str_replace('\\', '/', $filepath);
|
||||
if (FALSE !== strpos($filepath, '/'))
|
||||
{
|
||||
$x = explode('/', $filepath);
|
||||
$filepath = $x[count($x)-2].'/'.end($x);
|
||||
}
|
||||
|
||||
$template = 'html'.DIRECTORY_SEPARATOR.'error_php';
|
||||
}
|
||||
else
|
||||
{
|
||||
$template = 'cli'.DIRECTORY_SEPARATOR.'error_php';
|
||||
}
|
||||
|
||||
if (ob_get_level() > $this->ob_level + 1)
|
||||
{
|
||||
ob_end_flush();
|
||||
}
|
||||
ob_start();
|
||||
include($templates_path.$template.'.php');
|
||||
$buffer = ob_get_contents();
|
||||
ob_end_clean();
|
||||
echo $buffer;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Hooks Class
|
||||
*
|
||||
* Provides a mechanism to extend the base system without hacking.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/userguide3/general/hooks.html
|
||||
*/
|
||||
class CI_Hooks {
|
||||
|
||||
/**
|
||||
* Determines whether hooks are enabled
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $enabled = FALSE;
|
||||
|
||||
/**
|
||||
* List of all hooks set in config/hooks.php
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $hooks = array();
|
||||
|
||||
/**
|
||||
* Array with class objects to use hooks methods
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_objects = array();
|
||||
|
||||
/**
|
||||
* In progress flag
|
||||
*
|
||||
* Determines whether hook is in progress, used to prevent infinte loops
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $_in_progress = FALSE;
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$CFG =& load_class('Config', 'core');
|
||||
log_message('info', 'Hooks Class Initialized');
|
||||
|
||||
// If hooks are not enabled in the config file
|
||||
// there is nothing else to do
|
||||
if ($CFG->item('enable_hooks') === FALSE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Grab the "hooks" definition file.
|
||||
if (file_exists(APPPATH.'config/hooks.php'))
|
||||
{
|
||||
include(APPPATH.'config/hooks.php');
|
||||
}
|
||||
|
||||
if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'))
|
||||
{
|
||||
include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php');
|
||||
}
|
||||
|
||||
// If there are no hooks, we're done.
|
||||
if ( ! isset($hook) OR ! is_array($hook))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->hooks =& $hook;
|
||||
$this->enabled = TRUE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Call Hook
|
||||
*
|
||||
* Calls a particular hook. Called by CodeIgniter.php.
|
||||
*
|
||||
* @uses CI_Hooks::_run_hook()
|
||||
*
|
||||
* @param string $which Hook name
|
||||
* @return bool TRUE on success or FALSE on failure
|
||||
*/
|
||||
public function call_hook($which = '')
|
||||
{
|
||||
if ( ! $this->enabled OR ! isset($this->hooks[$which]))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (is_array($this->hooks[$which]) && ! isset($this->hooks[$which]['function']))
|
||||
{
|
||||
foreach ($this->hooks[$which] as $val)
|
||||
{
|
||||
$this->_run_hook($val);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_run_hook($this->hooks[$which]);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Run Hook
|
||||
*
|
||||
* Runs a particular hook
|
||||
*
|
||||
* @param array $data Hook details
|
||||
* @return bool TRUE on success or FALSE on failure
|
||||
*/
|
||||
protected function _run_hook($data)
|
||||
{
|
||||
// Closures/lambda functions and array($object, 'method') callables
|
||||
if (is_callable($data))
|
||||
{
|
||||
is_array($data)
|
||||
? $data[0]->{$data[1]}()
|
||||
: $data();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
elseif ( ! is_array($data))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
// Safety - Prevents run-away loops
|
||||
// -----------------------------------
|
||||
|
||||
// If the script being called happens to have the same
|
||||
// hook call within it a loop can happen
|
||||
if ($this->_in_progress === TRUE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
// Set file path
|
||||
// -----------------------------------
|
||||
|
||||
if ( ! isset($data['filepath'], $data['filename']))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$filepath = APPPATH.$data['filepath'].'/'.$data['filename'];
|
||||
|
||||
if ( ! file_exists($filepath))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Determine and class and/or function names
|
||||
$class = empty($data['class']) ? FALSE : $data['class'];
|
||||
$function = empty($data['function']) ? FALSE : $data['function'];
|
||||
$params = isset($data['params']) ? $data['params'] : '';
|
||||
|
||||
if (empty($function))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Set the _in_progress flag
|
||||
$this->_in_progress = TRUE;
|
||||
|
||||
// Call the requested class and/or function
|
||||
if ($class !== FALSE)
|
||||
{
|
||||
// The object is stored?
|
||||
if (isset($this->_objects[$class]))
|
||||
{
|
||||
if (method_exists($this->_objects[$class], $function))
|
||||
{
|
||||
$this->_objects[$class]->$function($params);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->_in_progress = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
class_exists($class, FALSE) OR require_once($filepath);
|
||||
|
||||
if ( ! class_exists($class, FALSE) OR ! method_exists($class, $function))
|
||||
{
|
||||
return $this->_in_progress = FALSE;
|
||||
}
|
||||
|
||||
// Store the object and execute the method
|
||||
$this->_objects[$class] = new $class();
|
||||
$this->_objects[$class]->$function($params);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
function_exists($function) OR require_once($filepath);
|
||||
|
||||
if ( ! function_exists($function))
|
||||
{
|
||||
return $this->_in_progress = FALSE;
|
||||
}
|
||||
|
||||
$function($params);
|
||||
}
|
||||
|
||||
$this->_in_progress = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,937 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Input Class
|
||||
*
|
||||
* Pre-processes global input data for security
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Libraries
|
||||
* @category Input
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/userguide3/libraries/input.html
|
||||
*/
|
||||
class CI_Input {
|
||||
|
||||
/**
|
||||
* IP address of the current user
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $ip_address = FALSE;
|
||||
|
||||
/**
|
||||
* Allow GET array flag
|
||||
*
|
||||
* If set to FALSE, then $_GET will be set to an empty array.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $_allow_get_array = TRUE;
|
||||
|
||||
/**
|
||||
* Standardize new lines flag
|
||||
*
|
||||
* If set to TRUE, then newlines are standardized.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $_standardize_newlines;
|
||||
|
||||
/**
|
||||
* Enable XSS flag
|
||||
*
|
||||
* Determines whether the XSS filter is always active when
|
||||
* GET, POST or COOKIE data is encountered.
|
||||
* Set automatically based on config setting.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $_enable_xss = FALSE;
|
||||
|
||||
/**
|
||||
* Enable CSRF flag
|
||||
*
|
||||
* Enables a CSRF cookie token to be set.
|
||||
* Set automatically based on config setting.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $_enable_csrf = FALSE;
|
||||
|
||||
/**
|
||||
* List of all HTTP request headers
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $headers = array();
|
||||
|
||||
/**
|
||||
* Raw input stream data
|
||||
*
|
||||
* Holds a cache of php://input contents
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_raw_input_stream;
|
||||
|
||||
/**
|
||||
* Parsed input stream data
|
||||
*
|
||||
* Parsed from php://input at runtime
|
||||
*
|
||||
* @see CI_Input::input_stream()
|
||||
* @var array
|
||||
*/
|
||||
protected $_input_stream;
|
||||
|
||||
protected $security;
|
||||
protected $uni;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* Determines whether to globally enable the XSS processing
|
||||
* and whether to allow the $_GET array.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_allow_get_array = (config_item('allow_get_array') !== FALSE);
|
||||
$this->_enable_xss = (config_item('global_xss_filtering') === TRUE);
|
||||
$this->_enable_csrf = (config_item('csrf_protection') === TRUE);
|
||||
$this->_standardize_newlines = (bool) config_item('standardize_newlines');
|
||||
|
||||
$this->security =& load_class('Security', 'core');
|
||||
|
||||
// Do we need the UTF-8 class?
|
||||
if (UTF8_ENABLED === TRUE)
|
||||
{
|
||||
$this->uni =& load_class('Utf8', 'core');
|
||||
}
|
||||
|
||||
// Sanitize global arrays
|
||||
$this->_sanitize_globals();
|
||||
|
||||
// CSRF Protection check
|
||||
if ($this->_enable_csrf === TRUE && ! is_cli())
|
||||
{
|
||||
$this->security->csrf_verify();
|
||||
}
|
||||
|
||||
log_message('info', 'Input Class Initialized');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch from array
|
||||
*
|
||||
* Internal method used to retrieve values from global arrays.
|
||||
*
|
||||
* @param array &$array $_GET, $_POST, $_COOKIE, $_SERVER, etc.
|
||||
* @param mixed $index Index for item to be fetched from $array
|
||||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
protected function _fetch_from_array(&$array, $index = NULL, $xss_clean = NULL)
|
||||
{
|
||||
is_bool($xss_clean) OR $xss_clean = $this->_enable_xss;
|
||||
|
||||
// If $index is NULL, it means that the whole $array is requested
|
||||
isset($index) OR $index = array_keys($array);
|
||||
|
||||
// allow fetching multiple keys at once
|
||||
if (is_array($index))
|
||||
{
|
||||
$output = array();
|
||||
foreach ($index as $key)
|
||||
{
|
||||
$output[$key] = $this->_fetch_from_array($array, $key, $xss_clean);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
if (isset($array[$index]))
|
||||
{
|
||||
$value = $array[$index];
|
||||
}
|
||||
elseif (($count = preg_match_all('/(?:^[^\[]+)|\[[^]]*\]/', $index, $matches)) > 1) // Does the index contain array notation
|
||||
{
|
||||
$value = $array;
|
||||
for ($i = 0; $i < $count; $i++)
|
||||
{
|
||||
$key = trim($matches[0][$i], '[]');
|
||||
if ($key === '') // Empty notation will return the value as array
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (isset($value[$key]))
|
||||
{
|
||||
$value = $value[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ($xss_clean === TRUE)
|
||||
? $this->security->xss_clean($value)
|
||||
: $value;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch an item from the GET array
|
||||
*
|
||||
* @param mixed $index Index for item to be fetched from $_GET
|
||||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($index = NULL, $xss_clean = NULL)
|
||||
{
|
||||
return $this->_fetch_from_array($_GET, $index, $xss_clean);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch an item from the POST array
|
||||
*
|
||||
* @param mixed $index Index for item to be fetched from $_POST
|
||||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
public function post($index = NULL, $xss_clean = NULL)
|
||||
{
|
||||
return $this->_fetch_from_array($_POST, $index, $xss_clean);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch an item from POST data with fallback to GET
|
||||
*
|
||||
* @param string $index Index for item to be fetched from $_POST or $_GET
|
||||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
public function post_get($index, $xss_clean = NULL)
|
||||
{
|
||||
return isset($_POST[$index])
|
||||
? $this->post($index, $xss_clean)
|
||||
: $this->get($index, $xss_clean);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch an item from GET data with fallback to POST
|
||||
*
|
||||
* @param string $index Index for item to be fetched from $_GET or $_POST
|
||||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_post($index, $xss_clean = NULL)
|
||||
{
|
||||
return isset($_GET[$index])
|
||||
? $this->get($index, $xss_clean)
|
||||
: $this->post($index, $xss_clean);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch an item from the COOKIE array
|
||||
*
|
||||
* @param mixed $index Index for item to be fetched from $_COOKIE
|
||||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
public function cookie($index = NULL, $xss_clean = NULL)
|
||||
{
|
||||
return $this->_fetch_from_array($_COOKIE, $index, $xss_clean);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch an item from the SERVER array
|
||||
*
|
||||
* @param mixed $index Index for item to be fetched from $_SERVER
|
||||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
public function server($index, $xss_clean = NULL)
|
||||
{
|
||||
return $this->_fetch_from_array($_SERVER, $index, $xss_clean);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch an item from the php://input stream
|
||||
*
|
||||
* Useful when you need to access PUT, DELETE or PATCH request data.
|
||||
*
|
||||
* @param string $index Index for item to be fetched
|
||||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return mixed
|
||||
*/
|
||||
public function input_stream($index = NULL, $xss_clean = NULL)
|
||||
{
|
||||
// Prior to PHP 5.6, the input stream can only be read once,
|
||||
// so we'll need to check if we have already done that first.
|
||||
if ( ! is_array($this->_input_stream))
|
||||
{
|
||||
// $this->raw_input_stream will trigger __get().
|
||||
parse_str($this->raw_input_stream, $this->_input_stream);
|
||||
is_array($this->_input_stream) OR $this->_input_stream = array();
|
||||
}
|
||||
|
||||
return $this->_fetch_from_array($this->_input_stream, $index, $xss_clean);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set cookie
|
||||
*
|
||||
* Accepts an arbitrary number of parameters (up to 7) or an associative
|
||||
* array in the first parameter containing all the values.
|
||||
*
|
||||
* @param string|mixed[] $name Cookie name or an array containing parameters
|
||||
* @param string $value Cookie value
|
||||
* @param int $expire Cookie expiration time in seconds
|
||||
* @param string $domain Cookie domain (e.g.: '.yourdomain.com')
|
||||
* @param string $path Cookie path (default: '/')
|
||||
* @param string $prefix Cookie name prefix
|
||||
* @param bool $secure Whether to only transfer cookies via SSL
|
||||
* @param bool $httponly Whether to only makes the cookie accessible via HTTP (no javascript)
|
||||
* @param string $samesite SameSite attribute
|
||||
* @return void
|
||||
*/
|
||||
public function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL, $samesite = NULL)
|
||||
{
|
||||
if (is_array($name))
|
||||
{
|
||||
// always leave 'name' in last place, as the loop will break otherwise, due to $$item
|
||||
foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'secure', 'httponly', 'name', 'samesite') as $item)
|
||||
{
|
||||
if (isset($name[$item]))
|
||||
{
|
||||
$$item = $name[$item];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($prefix === '' && config_item('cookie_prefix') !== '')
|
||||
{
|
||||
$prefix = config_item('cookie_prefix');
|
||||
}
|
||||
|
||||
if ($domain == '' && config_item('cookie_domain') != '')
|
||||
{
|
||||
$domain = config_item('cookie_domain');
|
||||
}
|
||||
|
||||
if ($path === '/' && config_item('cookie_path') !== '/')
|
||||
{
|
||||
$path = config_item('cookie_path');
|
||||
}
|
||||
|
||||
$secure = ($secure === NULL && config_item('cookie_secure') !== NULL)
|
||||
? (bool) config_item('cookie_secure')
|
||||
: (bool) $secure;
|
||||
|
||||
$httponly = ($httponly === NULL && config_item('cookie_httponly') !== NULL)
|
||||
? (bool) config_item('cookie_httponly')
|
||||
: (bool) $httponly;
|
||||
|
||||
if ( ! is_numeric($expire))
|
||||
{
|
||||
$expire = time() - 86500;
|
||||
}
|
||||
else
|
||||
{
|
||||
$expire = ($expire > 0) ? time() + $expire : 0;
|
||||
}
|
||||
|
||||
isset($samesite) OR $samesite = config_item('cookie_samesite');
|
||||
if (isset($samesite))
|
||||
{
|
||||
$samesite = ucfirst(strtolower($samesite));
|
||||
in_array($samesite, array('Lax', 'Strict', 'None'), TRUE) OR $samesite = 'Lax';
|
||||
}
|
||||
else
|
||||
{
|
||||
$samesite = 'Lax';
|
||||
}
|
||||
|
||||
if ($samesite === 'None' && ! $secure)
|
||||
{
|
||||
log_message('error', $name.' cookie sent with SameSite=None, but without Secure attribute.');
|
||||
}
|
||||
|
||||
if ( ! is_php('7.3'))
|
||||
{
|
||||
$maxage = $expire - time();
|
||||
if ($maxage < 1)
|
||||
{
|
||||
$maxage = 0;
|
||||
}
|
||||
|
||||
$cookie_header = 'Set-Cookie: '.$prefix.$name.'='.rawurlencode($value);
|
||||
$cookie_header .= ($expire === 0 ? '' : '; Expires='.gmdate('D, d-M-Y H:i:s T', $expire)).'; Max-Age='.$maxage;
|
||||
$cookie_header .= '; Path='.$path.($domain !== '' ? '; Domain='.$domain : '');
|
||||
$cookie_header .= ($secure ? '; Secure' : '').($httponly ? '; HttpOnly' : '').'; SameSite='.$samesite;
|
||||
header($cookie_header);
|
||||
return;
|
||||
}
|
||||
|
||||
$setcookie_options = array(
|
||||
'expires' => $expire,
|
||||
'path' => $path,
|
||||
'domain' => $domain,
|
||||
'secure' => $secure,
|
||||
'httponly' => $httponly,
|
||||
'samesite' => $samesite,
|
||||
);
|
||||
setcookie($prefix.$name, $value, $setcookie_options);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch the IP Address
|
||||
*
|
||||
* Determines and validates the visitor's IP address.
|
||||
*
|
||||
* @return string IP address
|
||||
*/
|
||||
public function ip_address()
|
||||
{
|
||||
if ($this->ip_address !== FALSE)
|
||||
{
|
||||
return $this->ip_address;
|
||||
}
|
||||
|
||||
$proxy_ips = config_item('proxy_ips');
|
||||
if ( ! empty($proxy_ips) && ! is_array($proxy_ips))
|
||||
{
|
||||
$proxy_ips = explode(',', str_replace(' ', '', $proxy_ips));
|
||||
}
|
||||
|
||||
$this->ip_address = $this->server('REMOTE_ADDR');
|
||||
|
||||
if ($proxy_ips)
|
||||
{
|
||||
foreach (array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_X_CLIENT_IP', 'HTTP_X_CLUSTER_CLIENT_IP') as $header)
|
||||
{
|
||||
if (($spoof = $this->server($header)) !== NULL)
|
||||
{
|
||||
// Some proxies typically list the whole chain of IP
|
||||
// addresses through which the client has reached us.
|
||||
// e.g. client_ip, proxy_ip1, proxy_ip2, etc.
|
||||
sscanf($spoof, '%[^,]', $spoof);
|
||||
|
||||
if ( ! $this->valid_ip($spoof))
|
||||
{
|
||||
$spoof = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($spoof)
|
||||
{
|
||||
for ($i = 0, $c = count($proxy_ips); $i < $c; $i++)
|
||||
{
|
||||
// Check if we have an IP address or a subnet
|
||||
if (strpos($proxy_ips[$i], '/') === FALSE)
|
||||
{
|
||||
// An IP address (and not a subnet) is specified.
|
||||
// We can compare right away.
|
||||
if ($proxy_ips[$i] === $this->ip_address)
|
||||
{
|
||||
$this->ip_address = $spoof;
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// We have a subnet ... now the heavy lifting begins
|
||||
isset($separator) OR $separator = $this->valid_ip($this->ip_address, 'ipv6') ? ':' : '.';
|
||||
|
||||
// If the proxy entry doesn't match the IP protocol - skip it
|
||||
if (strpos($proxy_ips[$i], $separator) === FALSE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Convert the REMOTE_ADDR IP address to binary, if needed
|
||||
if ( ! isset($ip, $sprintf))
|
||||
{
|
||||
if ($separator === ':')
|
||||
{
|
||||
// Make sure we're have the "full" IPv6 format
|
||||
$ip = explode(':',
|
||||
str_replace('::',
|
||||
str_repeat(':', 9 - substr_count($this->ip_address, ':')),
|
||||
$this->ip_address
|
||||
)
|
||||
);
|
||||
|
||||
for ($j = 0; $j < 8; $j++)
|
||||
{
|
||||
$ip[$j] = intval($ip[$j], 16);
|
||||
}
|
||||
|
||||
$sprintf = '%016b%016b%016b%016b%016b%016b%016b%016b';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ip = explode('.', $this->ip_address);
|
||||
$sprintf = '%08b%08b%08b%08b';
|
||||
}
|
||||
|
||||
$ip = vsprintf($sprintf, $ip);
|
||||
}
|
||||
|
||||
// Split the netmask length off the network address
|
||||
sscanf($proxy_ips[$i], '%[^/]/%d', $netaddr, $masklen);
|
||||
|
||||
// Again, an IPv6 address is most likely in a compressed form
|
||||
if ($separator === ':')
|
||||
{
|
||||
$netaddr = explode(':', str_replace('::', str_repeat(':', 9 - substr_count($netaddr, ':')), $netaddr));
|
||||
for ($j = 0; $j < 8; $j++)
|
||||
{
|
||||
$netaddr[$j] = intval($netaddr[$j], 16);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$netaddr = explode('.', $netaddr);
|
||||
}
|
||||
|
||||
// Convert to binary and finally compare
|
||||
if (strncmp($ip, vsprintf($sprintf, $netaddr), $masklen) === 0)
|
||||
{
|
||||
$this->ip_address = $spoof;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $this->valid_ip($this->ip_address))
|
||||
{
|
||||
return $this->ip_address = '0.0.0.0';
|
||||
}
|
||||
|
||||
return $this->ip_address;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Validate IP Address
|
||||
*
|
||||
* @param string $ip IP address
|
||||
* @param string $which IP protocol: 'ipv4' or 'ipv6'
|
||||
* @return bool
|
||||
*/
|
||||
public function valid_ip($ip, $which = '')
|
||||
{
|
||||
switch (strtolower($which))
|
||||
{
|
||||
case 'ipv4':
|
||||
$which = FILTER_FLAG_IPV4;
|
||||
break;
|
||||
case 'ipv6':
|
||||
$which = FILTER_FLAG_IPV6;
|
||||
break;
|
||||
default:
|
||||
$which = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return (bool) filter_var($ip, FILTER_VALIDATE_IP, $which);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch User Agent string
|
||||
*
|
||||
* @return string|null User Agent string or NULL if it doesn't exist
|
||||
*/
|
||||
public function user_agent($xss_clean = NULL)
|
||||
{
|
||||
return $this->_fetch_from_array($_SERVER, 'HTTP_USER_AGENT', $xss_clean);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Sanitize Globals
|
||||
*
|
||||
* Internal method serving for the following purposes:
|
||||
*
|
||||
* - Unsets $_GET data, if query strings are not enabled
|
||||
* - Cleans POST, COOKIE and SERVER data
|
||||
* - Standardizes newline characters to PHP_EOL
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _sanitize_globals()
|
||||
{
|
||||
// Is $_GET data allowed? If not we'll set the $_GET to an empty array
|
||||
if ($this->_allow_get_array === FALSE)
|
||||
{
|
||||
$_GET = array();
|
||||
}
|
||||
elseif (is_array($_GET))
|
||||
{
|
||||
foreach ($_GET as $key => $val)
|
||||
{
|
||||
$_GET[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
|
||||
}
|
||||
}
|
||||
|
||||
// Clean $_POST Data
|
||||
if (is_array($_POST))
|
||||
{
|
||||
foreach ($_POST as $key => $val)
|
||||
{
|
||||
$_POST[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
|
||||
}
|
||||
}
|
||||
|
||||
// Clean $_COOKIE Data
|
||||
if (is_array($_COOKIE))
|
||||
{
|
||||
// Also get rid of specially treated cookies that might be set by a server
|
||||
// or silly application, that are of no use to a CI application anyway
|
||||
// but that when present will trip our 'Disallowed Key Characters' alarm
|
||||
// http://www.ietf.org/rfc/rfc2109.txt
|
||||
// note that the key names below are single quoted strings, and are not PHP variables
|
||||
unset(
|
||||
$_COOKIE['$Version'],
|
||||
$_COOKIE['$Path'],
|
||||
$_COOKIE['$Domain']
|
||||
);
|
||||
|
||||
foreach ($_COOKIE as $key => $val)
|
||||
{
|
||||
if (($cookie_key = $this->_clean_input_keys($key)) !== FALSE)
|
||||
{
|
||||
$_COOKIE[$cookie_key] = $this->_clean_input_data($val);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($_COOKIE[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sanitize PHP_SELF
|
||||
$_SERVER['PHP_SELF'] = strip_tags($_SERVER['PHP_SELF']);
|
||||
|
||||
log_message('debug', 'Global POST, GET and COOKIE data sanitized');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Clean Input Data
|
||||
*
|
||||
* Internal method that aids in escaping data and
|
||||
* standardizing newline characters to PHP_EOL.
|
||||
*
|
||||
* @param string|string[] $str Input string(s)
|
||||
* @return string
|
||||
*/
|
||||
protected function _clean_input_data($str)
|
||||
{
|
||||
if (is_array($str))
|
||||
{
|
||||
$new_array = array();
|
||||
foreach (array_keys($str) as $key)
|
||||
{
|
||||
$new_array[$this->_clean_input_keys($key)] = $this->_clean_input_data($str[$key]);
|
||||
}
|
||||
return $new_array;
|
||||
}
|
||||
|
||||
/* We strip slashes if magic quotes is on to keep things consistent
|
||||
|
||||
NOTE: In PHP 5.4 get_magic_quotes_gpc() will always return 0 and
|
||||
it will probably not exist in future versions at all.
|
||||
*/
|
||||
if ( ! is_php('5.4') && get_magic_quotes_gpc())
|
||||
{
|
||||
$str = stripslashes($str);
|
||||
}
|
||||
|
||||
// Clean UTF-8 if supported
|
||||
if (UTF8_ENABLED === TRUE)
|
||||
{
|
||||
$str = $this->uni->clean_string($str);
|
||||
}
|
||||
|
||||
// Remove control characters
|
||||
$str = remove_invisible_characters($str, FALSE);
|
||||
|
||||
// Standardize newlines if needed
|
||||
if ($this->_standardize_newlines === TRUE)
|
||||
{
|
||||
return preg_replace('/(?:\r\n|[\r\n])/', PHP_EOL, $str);
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Clean Keys
|
||||
*
|
||||
* Internal method that helps to prevent malicious users
|
||||
* from trying to exploit keys we make sure that keys are
|
||||
* only named with alpha-numeric text and a few other items.
|
||||
*
|
||||
* @param string $str Input string
|
||||
* @param bool $fatal Whether to terminate script exection
|
||||
* or to return FALSE if an invalid
|
||||
* key is encountered
|
||||
* @return string|bool
|
||||
*/
|
||||
protected function _clean_input_keys($str, $fatal = TRUE)
|
||||
{
|
||||
if ( ! preg_match('/^[a-z0-9:_\/|-]+$/i', $str))
|
||||
{
|
||||
if ($fatal === TRUE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
set_status_header(503);
|
||||
echo 'Disallowed Key Characters.';
|
||||
exit(7); // EXIT_USER_INPUT
|
||||
}
|
||||
}
|
||||
|
||||
// Clean UTF-8 if supported
|
||||
if (UTF8_ENABLED === TRUE)
|
||||
{
|
||||
return $this->uni->clean_string($str);
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Request Headers
|
||||
*
|
||||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return array
|
||||
*/
|
||||
public function request_headers($xss_clean = FALSE)
|
||||
{
|
||||
// If header is already defined, return it immediately
|
||||
if ( ! empty($this->headers))
|
||||
{
|
||||
return $this->_fetch_from_array($this->headers, NULL, $xss_clean);
|
||||
}
|
||||
|
||||
// In Apache, you can simply call apache_request_headers()
|
||||
if (function_exists('apache_request_headers'))
|
||||
{
|
||||
$this->headers = apache_request_headers();
|
||||
}
|
||||
else
|
||||
{
|
||||
isset($_SERVER['CONTENT_TYPE']) && $this->headers['Content-Type'] = $_SERVER['CONTENT_TYPE'];
|
||||
|
||||
foreach ($_SERVER as $key => $val)
|
||||
{
|
||||
if (sscanf($key, 'HTTP_%s', $header) === 1)
|
||||
{
|
||||
// take SOME_HEADER and turn it into Some-Header
|
||||
$header = str_replace('_', ' ', strtolower($header));
|
||||
$header = str_replace(' ', '-', ucwords($header));
|
||||
|
||||
$this->headers[$header] = $_SERVER[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_fetch_from_array($this->headers, NULL, $xss_clean);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get Request Header
|
||||
*
|
||||
* Returns the value of a single member of the headers class member
|
||||
*
|
||||
* @param string $index Header name
|
||||
* @param bool $xss_clean Whether to apply XSS filtering
|
||||
* @return string|null The requested header on success or NULL on failure
|
||||
*/
|
||||
public function get_request_header($index, $xss_clean = FALSE)
|
||||
{
|
||||
static $headers;
|
||||
|
||||
if ( ! isset($headers))
|
||||
{
|
||||
empty($this->headers) && $this->request_headers();
|
||||
foreach ($this->headers as $key => $value)
|
||||
{
|
||||
$headers[strtolower($key)] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$index = strtolower($index);
|
||||
|
||||
if ( ! isset($headers[$index]))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ($xss_clean === TRUE)
|
||||
? $this->security->xss_clean($headers[$index])
|
||||
: $headers[$index];
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Is AJAX request?
|
||||
*
|
||||
* Test to see if a request contains the HTTP_X_REQUESTED_WITH header.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_ajax_request()
|
||||
{
|
||||
return ( ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Is CLI request?
|
||||
*
|
||||
* Test to see if a request was made from the command line.
|
||||
*
|
||||
* @deprecated 3.0.0 Use is_cli() instead
|
||||
* @return bool
|
||||
*/
|
||||
public function is_cli_request()
|
||||
{
|
||||
return is_cli();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get Request Method
|
||||
*
|
||||
* Return the request method
|
||||
*
|
||||
* @param bool $upper Whether to return in upper or lower case
|
||||
* (default: FALSE)
|
||||
* @return string
|
||||
*/
|
||||
public function method($upper = FALSE)
|
||||
{
|
||||
return ($upper)
|
||||
? strtoupper($this->server('REQUEST_METHOD'))
|
||||
: strtolower($this->server('REQUEST_METHOD'));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Magic __get()
|
||||
*
|
||||
* Allows read access to protected properties
|
||||
*
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
if ($name === 'raw_input_stream')
|
||||
{
|
||||
isset($this->_raw_input_stream) OR $this->_raw_input_stream = file_get_contents('php://input');
|
||||
return $this->_raw_input_stream;
|
||||
}
|
||||
elseif ($name === 'ip_address')
|
||||
{
|
||||
return $this->ip_address;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Language Class
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Libraries
|
||||
* @category Language
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/userguide3/libraries/language.html
|
||||
*/
|
||||
class CI_Lang {
|
||||
|
||||
/**
|
||||
* List of translations
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $language = array();
|
||||
|
||||
/**
|
||||
* List of loaded language files
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $is_loaded = array();
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
log_message('info', 'Language Class Initialized');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Load a language file
|
||||
*
|
||||
* @param mixed $langfile Language file name
|
||||
* @param string $idiom Language name (english, etc.)
|
||||
* @param bool $return Whether to return the loaded array of translations
|
||||
* @param bool $add_suffix Whether to add suffix to $langfile
|
||||
* @param string $alt_path Alternative path to look for the language file
|
||||
*
|
||||
* @return void|string[] Array containing translations, if $return is set to TRUE
|
||||
*/
|
||||
public function load($langfile, $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '')
|
||||
{
|
||||
if (is_array($langfile))
|
||||
{
|
||||
foreach ($langfile as $value)
|
||||
{
|
||||
$this->load($value, $idiom, $return, $add_suffix, $alt_path);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$langfile = str_replace('.php', '', $langfile);
|
||||
|
||||
if ($add_suffix === TRUE)
|
||||
{
|
||||
$langfile = preg_replace('/_lang$/', '', $langfile).'_lang';
|
||||
}
|
||||
|
||||
$langfile .= '.php';
|
||||
|
||||
if (empty($idiom) OR ! preg_match('/^[a-z_-]+$/i', $idiom))
|
||||
{
|
||||
$config =& get_config();
|
||||
$idiom = empty($config['language']) ? 'english' : $config['language'];
|
||||
}
|
||||
|
||||
if ($return === FALSE && isset($this->is_loaded[$langfile]) && $this->is_loaded[$langfile] === $idiom)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Load the base file, so any others found can override it
|
||||
$basepath = BASEPATH.'language/'.$idiom.'/'.$langfile;
|
||||
if (($found = file_exists($basepath)) === TRUE)
|
||||
{
|
||||
include($basepath);
|
||||
}
|
||||
|
||||
// Do we have an alternative path to look in?
|
||||
if ($alt_path !== '')
|
||||
{
|
||||
$alt_path .= 'language/'.$idiom.'/'.$langfile;
|
||||
if (file_exists($alt_path))
|
||||
{
|
||||
include($alt_path);
|
||||
$found = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (get_instance()->load->get_package_paths(TRUE) as $package_path)
|
||||
{
|
||||
$package_path .= 'language/'.$idiom.'/'.$langfile;
|
||||
if ($basepath !== $package_path && file_exists($package_path))
|
||||
{
|
||||
include($package_path);
|
||||
$found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($found !== TRUE)
|
||||
{
|
||||
show_error('Unable to load the requested language file: language/'.$idiom.'/'.$langfile);
|
||||
}
|
||||
|
||||
if ( ! isset($lang) OR ! is_array($lang))
|
||||
{
|
||||
log_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile);
|
||||
|
||||
if ($return === TRUE)
|
||||
{
|
||||
return array();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ($return === TRUE)
|
||||
{
|
||||
return $lang;
|
||||
}
|
||||
|
||||
$this->is_loaded[$langfile] = $idiom;
|
||||
$this->language = array_merge($this->language, $lang);
|
||||
|
||||
log_message('info', 'Language file loaded: language/'.$idiom.'/'.$langfile);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Language line
|
||||
*
|
||||
* Fetches a single line of text from the language array
|
||||
*
|
||||
* @param string $line Language line key
|
||||
* @param bool $log_errors Whether to log an error message if the line is not found
|
||||
* @return string Translation
|
||||
*/
|
||||
public function line($line, $log_errors = TRUE)
|
||||
{
|
||||
$value = isset($this->language[$line]) ? $this->language[$line] : FALSE;
|
||||
|
||||
// Because killer robots like unicorns!
|
||||
if ($value === FALSE && $log_errors === TRUE)
|
||||
{
|
||||
log_message('error', 'Could not find the language line "'.$line.'"');
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,297 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Logging Class
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Libraries
|
||||
* @category Logging
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/userguide3/general/errors.html
|
||||
*/
|
||||
class CI_Log {
|
||||
|
||||
/**
|
||||
* Path to save log files
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_log_path;
|
||||
|
||||
/**
|
||||
* File permissions
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_file_permissions = 0644;
|
||||
|
||||
/**
|
||||
* Level of logging
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_threshold = 1;
|
||||
|
||||
/**
|
||||
* Array of threshold levels to log
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_threshold_array = array();
|
||||
|
||||
/**
|
||||
* Format of timestamp for log files
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_date_fmt = 'Y-m-d H:i:s';
|
||||
|
||||
/**
|
||||
* Filename extension
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_file_ext;
|
||||
|
||||
/**
|
||||
* Whether or not the logger can write to the log files
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $_enabled = TRUE;
|
||||
|
||||
/**
|
||||
* Predefined logging levels
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_levels = array('ERROR' => 1, 'DEBUG' => 2, 'INFO' => 3, 'ALL' => 4);
|
||||
|
||||
/**
|
||||
* mbstring.func_overload flag
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected static $func_overload;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$config =& get_config();
|
||||
|
||||
isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
|
||||
|
||||
$this->_log_path = ($config['log_path'] !== '') ? $config['log_path'] : APPPATH.'logs/';
|
||||
$this->_file_ext = (isset($config['log_file_extension']) && $config['log_file_extension'] !== '')
|
||||
? ltrim($config['log_file_extension'], '.') : 'php';
|
||||
|
||||
file_exists($this->_log_path) OR mkdir($this->_log_path, 0755, TRUE);
|
||||
|
||||
if ( ! is_dir($this->_log_path) OR ! is_really_writable($this->_log_path))
|
||||
{
|
||||
$this->_enabled = FALSE;
|
||||
}
|
||||
|
||||
if (is_numeric($config['log_threshold']))
|
||||
{
|
||||
$this->_threshold = (int) $config['log_threshold'];
|
||||
}
|
||||
elseif (is_array($config['log_threshold']))
|
||||
{
|
||||
$this->_threshold = 0;
|
||||
$this->_threshold_array = array_flip($config['log_threshold']);
|
||||
}
|
||||
|
||||
if ( ! empty($config['log_date_format']))
|
||||
{
|
||||
$this->_date_fmt = $config['log_date_format'];
|
||||
}
|
||||
|
||||
if ( ! empty($config['log_file_permissions']) && is_int($config['log_file_permissions']))
|
||||
{
|
||||
$this->_file_permissions = $config['log_file_permissions'];
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Write Log File
|
||||
*
|
||||
* Generally this function will be called using the global log_message() function
|
||||
*
|
||||
* @param string $level The error level: 'error', 'debug' or 'info'
|
||||
* @param string $msg The error message
|
||||
* @return bool
|
||||
*/
|
||||
public function write_log($level, $msg)
|
||||
{
|
||||
if ($this->_enabled === FALSE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$level = strtoupper($level);
|
||||
|
||||
if (( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold))
|
||||
&& ! isset($this->_threshold_array[$this->_levels[$level]]))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$filepath = $this->_log_path.'log-'.date('Y-m-d').'.'.$this->_file_ext;
|
||||
$message = '';
|
||||
|
||||
if ( ! file_exists($filepath))
|
||||
{
|
||||
$newfile = TRUE;
|
||||
// Only add protection to php files
|
||||
if ($this->_file_ext === 'php')
|
||||
{
|
||||
$message .= "<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $fp = @fopen($filepath, 'ab'))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
flock($fp, LOCK_EX);
|
||||
|
||||
// Instantiating DateTime with microseconds appended to initial date is needed for proper support of this format
|
||||
if (strpos($this->_date_fmt, 'u') !== FALSE)
|
||||
{
|
||||
$microtime_full = microtime(TRUE);
|
||||
$microtime_short = sprintf("%06d", ($microtime_full - floor($microtime_full)) * 1000000);
|
||||
$date = new DateTime(date('Y-m-d H:i:s.'.$microtime_short, $microtime_full));
|
||||
$date = $date->format($this->_date_fmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
$date = date($this->_date_fmt);
|
||||
}
|
||||
|
||||
$message .= $this->_format_line($level, $date, $msg);
|
||||
|
||||
for ($written = 0, $length = self::strlen($message); $written < $length; $written += $result)
|
||||
{
|
||||
if (($result = fwrite($fp, self::substr($message, $written))) === FALSE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
flock($fp, LOCK_UN);
|
||||
fclose($fp);
|
||||
|
||||
if (isset($newfile) && $newfile === TRUE)
|
||||
{
|
||||
chmod($filepath, $this->_file_permissions);
|
||||
}
|
||||
|
||||
return is_int($result);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Format the log line.
|
||||
*
|
||||
* This is for extensibility of log formatting
|
||||
* If you want to change the log format, extend the CI_Log class and override this method
|
||||
*
|
||||
* @param string $level The error level
|
||||
* @param string $date Formatted date string
|
||||
* @param string $message The log message
|
||||
* @return string Formatted log line with a new line character at the end
|
||||
*/
|
||||
protected function _format_line($level, $date, $message)
|
||||
{
|
||||
return $level.' - '.$date.' --> '.$message.PHP_EOL;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Byte-safe strlen()
|
||||
*
|
||||
* @param string $str
|
||||
* @return int
|
||||
*/
|
||||
protected static function strlen($str)
|
||||
{
|
||||
return (self::$func_overload)
|
||||
? mb_strlen($str, '8bit')
|
||||
: strlen($str);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Byte-safe substr()
|
||||
*
|
||||
* @param string $str
|
||||
* @param int $start
|
||||
* @param int $length
|
||||
* @return string
|
||||
*/
|
||||
protected static function substr($str, $start, $length = NULL)
|
||||
{
|
||||
if (self::$func_overload)
|
||||
{
|
||||
// mb_substr($str, $start, null, '8bit') returns an empty
|
||||
// string on PHP 5.3
|
||||
isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start);
|
||||
return mb_substr($str, $start, $length, '8bit');
|
||||
}
|
||||
|
||||
return isset($length)
|
||||
? substr($str, $start, $length)
|
||||
: substr($str, $start);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Model Class
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/userguide3/libraries/config.html
|
||||
*/
|
||||
class CI_Model {
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @link https://github.com/bcit-ci/CodeIgniter/issues/5332
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {}
|
||||
|
||||
/**
|
||||
* __get magic
|
||||
*
|
||||
* Allows models to access CI's loaded classes using the same
|
||||
* syntax as controllers.
|
||||
*
|
||||
* @param string $key
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
// Debugging note:
|
||||
// If you're here because you're getting an error message
|
||||
// saying 'Undefined Property: system/core/Model.php', it's
|
||||
// most likely a typo in your model code.
|
||||
return get_instance()->$key;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,847 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Output Class
|
||||
*
|
||||
* Responsible for sending final output to the browser.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Libraries
|
||||
* @category Output
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/userguide3/libraries/output.html
|
||||
*/
|
||||
class CI_Output {
|
||||
|
||||
/**
|
||||
* Final output string
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $final_output = '';
|
||||
|
||||
/**
|
||||
* Cache expiration time
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $cache_expiration = 0;
|
||||
|
||||
/**
|
||||
* List of server headers
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $headers = array();
|
||||
|
||||
/**
|
||||
* List of mime types
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $mimes = array();
|
||||
|
||||
/**
|
||||
* Mime-type for the current page
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $mime_type = 'text/html';
|
||||
|
||||
/**
|
||||
* Enable Profiler flag
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $enable_profiler = FALSE;
|
||||
|
||||
/**
|
||||
* php.ini zlib.output_compression flag
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $_zlib_oc = FALSE;
|
||||
|
||||
/**
|
||||
* CI output compression flag
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $_compress_output = FALSE;
|
||||
|
||||
/**
|
||||
* List of profiler sections
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_profiler_sections = array();
|
||||
|
||||
/**
|
||||
* Parse markers flag
|
||||
*
|
||||
* Whether or not to parse variables like {elapsed_time} and {memory_usage}.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $parse_exec_vars = TRUE;
|
||||
|
||||
/**
|
||||
* mbstring.func_overload flag
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected static $func_overload;
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* Determines whether zLib output compression will be used.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_zlib_oc = (bool) ini_get('zlib.output_compression');
|
||||
$this->_compress_output = (
|
||||
$this->_zlib_oc === FALSE
|
||||
&& config_item('compress_output') === TRUE
|
||||
&& extension_loaded('zlib')
|
||||
);
|
||||
|
||||
isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
|
||||
|
||||
// Get mime types for later
|
||||
$this->mimes =& get_mimes();
|
||||
|
||||
log_message('info', 'Output Class Initialized');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get Output
|
||||
*
|
||||
* Returns the current output string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_output()
|
||||
{
|
||||
return $this->final_output;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set Output
|
||||
*
|
||||
* Sets the output string.
|
||||
*
|
||||
* @param string $output Output data
|
||||
* @return CI_Output
|
||||
*/
|
||||
public function set_output($output)
|
||||
{
|
||||
$this->final_output = $output;
|
||||
return $this;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Append Output
|
||||
*
|
||||
* Appends data onto the output string.
|
||||
*
|
||||
* @param string $output Data to append
|
||||
* @return CI_Output
|
||||
*/
|
||||
public function append_output($output)
|
||||
{
|
||||
$this->final_output .= $output;
|
||||
return $this;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set Header
|
||||
*
|
||||
* Lets you set a server header which will be sent with the final output.
|
||||
*
|
||||
* Note: If a file is cached, headers will not be sent.
|
||||
* @todo We need to figure out how to permit headers to be cached.
|
||||
*
|
||||
* @param string $header Header
|
||||
* @param bool $replace Whether to replace the old header value, if already set
|
||||
* @return CI_Output
|
||||
*/
|
||||
public function set_header($header, $replace = TRUE)
|
||||
{
|
||||
// If zlib.output_compression is enabled it will compress the output,
|
||||
// but it will not modify the content-length header to compensate for
|
||||
// the reduction, causing the browser to hang waiting for more data.
|
||||
// We'll just skip content-length in those cases.
|
||||
if ($this->_zlib_oc && strncasecmp($header, 'content-length', 14) === 0)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->headers[] = array($header, $replace);
|
||||
return $this;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set Content-Type Header
|
||||
*
|
||||
* @param string $mime_type Extension of the file we're outputting
|
||||
* @param string $charset Character set (default: NULL)
|
||||
* @return CI_Output
|
||||
*/
|
||||
public function set_content_type($mime_type, $charset = NULL)
|
||||
{
|
||||
if (strpos($mime_type, '/') === FALSE)
|
||||
{
|
||||
$extension = ltrim($mime_type, '.');
|
||||
|
||||
// Is this extension supported?
|
||||
if (isset($this->mimes[$extension]))
|
||||
{
|
||||
$mime_type =& $this->mimes[$extension];
|
||||
|
||||
if (is_array($mime_type))
|
||||
{
|
||||
$mime_type = current($mime_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->mime_type = $mime_type;
|
||||
|
||||
if (empty($charset))
|
||||
{
|
||||
$charset = config_item('charset');
|
||||
}
|
||||
|
||||
$header = 'Content-Type: '.$mime_type
|
||||
.(empty($charset) ? '' : '; charset='.$charset);
|
||||
|
||||
$this->headers[] = array($header, TRUE);
|
||||
return $this;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get Current Content-Type Header
|
||||
*
|
||||
* @return string 'text/html', if not already set
|
||||
*/
|
||||
public function get_content_type()
|
||||
{
|
||||
for ($i = 0, $c = count($this->headers); $i < $c; $i++)
|
||||
{
|
||||
if (sscanf($this->headers[$i][0], 'Content-Type: %[^;]', $content_type) === 1)
|
||||
{
|
||||
return $content_type;
|
||||
}
|
||||
}
|
||||
|
||||
return 'text/html';
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get Header
|
||||
*
|
||||
* @param string $header
|
||||
* @return string
|
||||
*/
|
||||
public function get_header($header)
|
||||
{
|
||||
// We only need [x][0] from our multi-dimensional array
|
||||
$header_lines = array_map(function ($headers)
|
||||
{
|
||||
return array_shift($headers);
|
||||
}, $this->headers);
|
||||
|
||||
$headers = array_merge(
|
||||
$header_lines,
|
||||
headers_list()
|
||||
);
|
||||
|
||||
if (empty($headers) OR empty($header))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Count backwards, in order to get the last matching header
|
||||
for ($c = count($headers) - 1; $c > -1; $c--)
|
||||
{
|
||||
if (strncasecmp($header, $headers[$c], $l = self::strlen($header)) === 0)
|
||||
{
|
||||
return trim(self::substr($headers[$c], $l+1));
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set HTTP Status Header
|
||||
*
|
||||
* As of version 1.7.2, this is an alias for common function
|
||||
* set_status_header().
|
||||
*
|
||||
* @param int $code Status code (default: 200)
|
||||
* @param string $text Optional message
|
||||
* @return CI_Output
|
||||
*/
|
||||
public function set_status_header($code = 200, $text = '')
|
||||
{
|
||||
set_status_header($code, $text);
|
||||
return $this;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Enable/disable Profiler
|
||||
*
|
||||
* @param bool $val TRUE to enable or FALSE to disable
|
||||
* @return CI_Output
|
||||
*/
|
||||
public function enable_profiler($val = TRUE)
|
||||
{
|
||||
$this->enable_profiler = is_bool($val) ? $val : TRUE;
|
||||
return $this;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set Profiler Sections
|
||||
*
|
||||
* Allows override of default/config settings for
|
||||
* Profiler section display.
|
||||
*
|
||||
* @param array $sections Profiler sections
|
||||
* @return CI_Output
|
||||
*/
|
||||
public function set_profiler_sections($sections)
|
||||
{
|
||||
if (isset($sections['query_toggle_count']))
|
||||
{
|
||||
$this->_profiler_sections['query_toggle_count'] = (int) $sections['query_toggle_count'];
|
||||
unset($sections['query_toggle_count']);
|
||||
}
|
||||
|
||||
foreach ($sections as $section => $enable)
|
||||
{
|
||||
$this->_profiler_sections[$section] = ($enable !== FALSE);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set Cache
|
||||
*
|
||||
* @param int $time Cache expiration time in minutes
|
||||
* @return CI_Output
|
||||
*/
|
||||
public function cache($time)
|
||||
{
|
||||
$this->cache_expiration = is_numeric($time) ? $time : 0;
|
||||
return $this;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Display Output
|
||||
*
|
||||
* Processes and sends finalized output data to the browser along
|
||||
* with any server headers and profile data. It also stops benchmark
|
||||
* timers so the page rendering speed and memory usage can be shown.
|
||||
*
|
||||
* Note: All "view" data is automatically put into $this->final_output
|
||||
* by controller class.
|
||||
*
|
||||
* @uses CI_Output::$final_output
|
||||
* @param string $output Output data override
|
||||
* @return void
|
||||
*/
|
||||
public function _display($output = '')
|
||||
{
|
||||
// Note: We use load_class() because we can't use $CI =& get_instance()
|
||||
// since this function is sometimes called by the caching mechanism,
|
||||
// which happens before the CI super object is available.
|
||||
$BM =& load_class('Benchmark', 'core');
|
||||
$CFG =& load_class('Config', 'core');
|
||||
|
||||
// Grab the super object if we can.
|
||||
if (class_exists('CI_Controller', FALSE))
|
||||
{
|
||||
$CI =& get_instance();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// Set the output data
|
||||
if ($output === '')
|
||||
{
|
||||
$output =& $this->final_output;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// Do we need to write a cache file? Only if the controller does not have its
|
||||
// own _output() method and we are not dealing with a cache file, which we
|
||||
// can determine by the existence of the $CI object above
|
||||
if ($this->cache_expiration > 0 && isset($CI) && ! method_exists($CI, '_output'))
|
||||
{
|
||||
$this->_write_cache($output);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// Parse out the elapsed time and memory usage,
|
||||
// then swap the pseudo-variables with the data
|
||||
|
||||
$elapsed = $BM->elapsed_time('total_execution_time_start', 'total_execution_time_end');
|
||||
|
||||
if ($this->parse_exec_vars === TRUE)
|
||||
{
|
||||
$memory = round(memory_get_usage() / 1024 / 1024, 2).'MB';
|
||||
$output = str_replace(array('{elapsed_time}', '{memory_usage}'), array($elapsed, $memory), $output);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// Is compression requested?
|
||||
if (isset($CI) // This means that we're not serving a cache file, if we were, it would already be compressed
|
||||
&& $this->_compress_output === TRUE
|
||||
&& isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE)
|
||||
{
|
||||
ob_start('ob_gzhandler');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// Are there any server headers to send?
|
||||
if (count($this->headers) > 0)
|
||||
{
|
||||
foreach ($this->headers as $header)
|
||||
{
|
||||
@header($header[0], $header[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// Does the $CI object exist?
|
||||
// If not we know we are dealing with a cache file so we'll
|
||||
// simply echo out the data and exit.
|
||||
if ( ! isset($CI))
|
||||
{
|
||||
if ($this->_compress_output === TRUE)
|
||||
{
|
||||
if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE)
|
||||
{
|
||||
header('Content-Encoding: gzip');
|
||||
header('Content-Length: '.self::strlen($output));
|
||||
}
|
||||
else
|
||||
{
|
||||
// User agent doesn't support gzip compression,
|
||||
// so we'll have to decompress our cache
|
||||
$output = gzinflate(self::substr($output, 10, -8));
|
||||
}
|
||||
}
|
||||
|
||||
echo $output;
|
||||
log_message('info', 'Final output sent to browser');
|
||||
log_message('debug', 'Total execution time: '.$elapsed);
|
||||
return;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// Do we need to generate profile data?
|
||||
// If so, load the Profile class and run it.
|
||||
if ($this->enable_profiler === TRUE)
|
||||
{
|
||||
$CI->load->library('profiler');
|
||||
if ( ! empty($this->_profiler_sections))
|
||||
{
|
||||
$CI->profiler->set_sections($this->_profiler_sections);
|
||||
}
|
||||
|
||||
// If the output data contains closing </body> and </html> tags
|
||||
// we will remove them and add them back after we insert the profile data
|
||||
$output = preg_replace('|</body>.*?</html>|is', '', $output, -1, $count).$CI->profiler->run();
|
||||
if ($count > 0)
|
||||
{
|
||||
$output .= '</body></html>';
|
||||
}
|
||||
}
|
||||
|
||||
// Does the controller contain a function named _output()?
|
||||
// If so send the output there. Otherwise, echo it.
|
||||
if (method_exists($CI, '_output'))
|
||||
{
|
||||
$CI->_output($output);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $output; // Send it to the browser!
|
||||
}
|
||||
|
||||
log_message('info', 'Final output sent to browser');
|
||||
log_message('debug', 'Total execution time: '.$elapsed);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Write Cache
|
||||
*
|
||||
* @param string $output Output data to cache
|
||||
* @return void
|
||||
*/
|
||||
public function _write_cache($output)
|
||||
{
|
||||
$CI =& get_instance();
|
||||
$path = $CI->config->item('cache_path');
|
||||
$cache_path = ($path === '') ? APPPATH.'cache/' : $path;
|
||||
|
||||
if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path))
|
||||
{
|
||||
log_message('error', 'Unable to write cache file: '.$cache_path);
|
||||
return;
|
||||
}
|
||||
|
||||
$uri = $CI->config->item('base_url')
|
||||
.$CI->config->item('index_page')
|
||||
.$CI->uri->uri_string();
|
||||
|
||||
if (($cache_query_string = $CI->config->item('cache_query_string')) && ! empty($_SERVER['QUERY_STRING']))
|
||||
{
|
||||
if (is_array($cache_query_string))
|
||||
{
|
||||
$uri .= '?'.http_build_query(array_intersect_key($_GET, array_flip($cache_query_string)));
|
||||
}
|
||||
else
|
||||
{
|
||||
$uri .= '?'.$_SERVER['QUERY_STRING'];
|
||||
}
|
||||
}
|
||||
|
||||
$cache_path .= md5($uri);
|
||||
|
||||
if ( ! $fp = @fopen($cache_path, 'w+b'))
|
||||
{
|
||||
log_message('error', 'Unable to write cache file: '.$cache_path);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! flock($fp, LOCK_EX))
|
||||
{
|
||||
log_message('error', 'Unable to secure a file lock for file at: '.$cache_path);
|
||||
fclose($fp);
|
||||
return;
|
||||
}
|
||||
|
||||
// If output compression is enabled, compress the cache
|
||||
// itself, so that we don't have to do that each time
|
||||
// we're serving it
|
||||
if ($this->_compress_output === TRUE)
|
||||
{
|
||||
$output = gzencode($output);
|
||||
|
||||
if ($this->get_header('content-type') === NULL)
|
||||
{
|
||||
$this->set_content_type($this->mime_type);
|
||||
}
|
||||
}
|
||||
|
||||
$expire = time() + ($this->cache_expiration * 60);
|
||||
|
||||
// Put together our serialized info.
|
||||
$cache_info = serialize(array(
|
||||
'expire' => $expire,
|
||||
'headers' => $this->headers
|
||||
));
|
||||
|
||||
$output = $cache_info.'ENDCI--->'.$output;
|
||||
|
||||
for ($written = 0, $length = self::strlen($output); $written < $length; $written += $result)
|
||||
{
|
||||
if (($result = fwrite($fp, self::substr($output, $written))) === FALSE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
flock($fp, LOCK_UN);
|
||||
fclose($fp);
|
||||
|
||||
if ( ! is_int($result))
|
||||
{
|
||||
@unlink($cache_path);
|
||||
log_message('error', 'Unable to write the complete cache content at: '.$cache_path);
|
||||
return;
|
||||
}
|
||||
|
||||
chmod($cache_path, 0640);
|
||||
log_message('debug', 'Cache file written: '.$cache_path);
|
||||
|
||||
// Send HTTP cache-control headers to browser to match file cache settings.
|
||||
$this->set_cache_header($_SERVER['REQUEST_TIME'], $expire);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Update/serve cached output
|
||||
*
|
||||
* @uses CI_Config
|
||||
* @uses CI_URI
|
||||
*
|
||||
* @param object &$CFG CI_Config class instance
|
||||
* @param object &$URI CI_URI class instance
|
||||
* @return bool TRUE on success or FALSE on failure
|
||||
*/
|
||||
public function _display_cache(&$CFG, &$URI)
|
||||
{
|
||||
$cache_path = ($CFG->item('cache_path') === '') ? APPPATH.'cache/' : $CFG->item('cache_path');
|
||||
|
||||
// Build the file path. The file name is an MD5 hash of the full URI
|
||||
$uri = $CFG->item('base_url').$CFG->item('index_page').$URI->uri_string;
|
||||
|
||||
if (($cache_query_string = $CFG->item('cache_query_string')) && ! empty($_SERVER['QUERY_STRING']))
|
||||
{
|
||||
if (is_array($cache_query_string))
|
||||
{
|
||||
$uri .= '?'.http_build_query(array_intersect_key($_GET, array_flip($cache_query_string)));
|
||||
}
|
||||
else
|
||||
{
|
||||
$uri .= '?'.$_SERVER['QUERY_STRING'];
|
||||
}
|
||||
}
|
||||
|
||||
$filepath = $cache_path.md5($uri);
|
||||
|
||||
if ( ! file_exists($filepath) OR ! $fp = @fopen($filepath, 'rb'))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
flock($fp, LOCK_SH);
|
||||
|
||||
$cache = (filesize($filepath) > 0) ? fread($fp, filesize($filepath)) : '';
|
||||
|
||||
flock($fp, LOCK_UN);
|
||||
fclose($fp);
|
||||
|
||||
// Look for embedded serialized file info.
|
||||
if ( ! preg_match('/^(.*)ENDCI--->/', $cache, $match))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$cache_info = unserialize($match[1]);
|
||||
$expire = $cache_info['expire'];
|
||||
|
||||
$last_modified = filemtime($filepath);
|
||||
|
||||
// Has the file expired?
|
||||
if ($_SERVER['REQUEST_TIME'] >= $expire && is_really_writable($cache_path))
|
||||
{
|
||||
// If so we'll delete it.
|
||||
@unlink($filepath);
|
||||
log_message('debug', 'Cache file has expired. File deleted.');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Send the HTTP cache control headers
|
||||
$this->set_cache_header($last_modified, $expire);
|
||||
|
||||
// Add headers from cache file.
|
||||
foreach ($cache_info['headers'] as $header)
|
||||
{
|
||||
$this->set_header($header[0], $header[1]);
|
||||
}
|
||||
|
||||
// Display the cache
|
||||
$this->_display(self::substr($cache, self::strlen($match[0])));
|
||||
log_message('debug', 'Cache file is current. Sending it to browser.');
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Delete cache
|
||||
*
|
||||
* @param string $uri URI string
|
||||
* @return bool
|
||||
*/
|
||||
public function delete_cache($uri = '')
|
||||
{
|
||||
$CI =& get_instance();
|
||||
$cache_path = $CI->config->item('cache_path');
|
||||
if ($cache_path === '')
|
||||
{
|
||||
$cache_path = APPPATH.'cache/';
|
||||
}
|
||||
|
||||
if ( ! is_dir($cache_path))
|
||||
{
|
||||
log_message('error', 'Unable to find cache path: '.$cache_path);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (empty($uri))
|
||||
{
|
||||
$uri = $CI->uri->uri_string();
|
||||
|
||||
if (($cache_query_string = $CI->config->item('cache_query_string')) && ! empty($_SERVER['QUERY_STRING']))
|
||||
{
|
||||
if (is_array($cache_query_string))
|
||||
{
|
||||
$uri .= '?'.http_build_query(array_intersect_key($_GET, array_flip($cache_query_string)));
|
||||
}
|
||||
else
|
||||
{
|
||||
$uri .= '?'.$_SERVER['QUERY_STRING'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$cache_path .= md5($CI->config->item('base_url').$CI->config->item('index_page').ltrim($uri, '/'));
|
||||
|
||||
if ( ! @unlink($cache_path))
|
||||
{
|
||||
log_message('error', 'Unable to delete cache file for '.$uri);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set Cache Header
|
||||
*
|
||||
* Set the HTTP headers to match the server-side file cache settings
|
||||
* in order to reduce bandwidth.
|
||||
*
|
||||
* @param int $last_modified Timestamp of when the page was last modified
|
||||
* @param int $expiration Timestamp of when should the requested page expire from cache
|
||||
* @return void
|
||||
*/
|
||||
public function set_cache_header($last_modified, $expiration)
|
||||
{
|
||||
$max_age = $expiration - $_SERVER['REQUEST_TIME'];
|
||||
|
||||
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $last_modified <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']))
|
||||
{
|
||||
$this->set_status_header(304);
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Pragma: public');
|
||||
header('Cache-Control: max-age='.$max_age.', public');
|
||||
header('Expires: '.gmdate('D, d M Y H:i:s', $expiration).' GMT');
|
||||
header('Last-modified: '.gmdate('D, d M Y H:i:s', $last_modified).' GMT');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Byte-safe strlen()
|
||||
*
|
||||
* @param string $str
|
||||
* @return int
|
||||
*/
|
||||
protected static function strlen($str)
|
||||
{
|
||||
return (self::$func_overload)
|
||||
? mb_strlen($str, '8bit')
|
||||
: strlen($str);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Byte-safe substr()
|
||||
*
|
||||
* @param string $str
|
||||
* @param int $start
|
||||
* @param int $length
|
||||
* @return string
|
||||
*/
|
||||
protected static function substr($str, $start, $length = NULL)
|
||||
{
|
||||
if (self::$func_overload)
|
||||
{
|
||||
// mb_substr($str, $start, null, '8bit') returns an empty
|
||||
// string on PHP 5.3
|
||||
isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start);
|
||||
return mb_substr($str, $start, $length, '8bit');
|
||||
}
|
||||
|
||||
return isset($length)
|
||||
? substr($str, $start, $length)
|
||||
: substr($str, $start);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,516 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Router Class
|
||||
*
|
||||
* Parses URIs and determines routing
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Libraries
|
||||
* @category Libraries
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/userguide3/general/routing.html
|
||||
*/
|
||||
class CI_Router {
|
||||
|
||||
/**
|
||||
* CI_Config class object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
public $config;
|
||||
|
||||
/**
|
||||
* List of routes
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $routes = array();
|
||||
|
||||
/**
|
||||
* Current class name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $class = '';
|
||||
|
||||
/**
|
||||
* Current method name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $method = 'index';
|
||||
|
||||
/**
|
||||
* Sub-directory that contains the requested controller class
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $directory;
|
||||
|
||||
/**
|
||||
* Default controller (and method if specific)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $default_controller;
|
||||
|
||||
/**
|
||||
* Translate URI dashes
|
||||
*
|
||||
* Determines whether dashes in controller & method segments
|
||||
* should be automatically replaced by underscores.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $translate_uri_dashes = FALSE;
|
||||
|
||||
/**
|
||||
* Enable query strings flag
|
||||
*
|
||||
* Determines whether to use GET parameters or segment URIs
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $enable_query_strings = FALSE;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* Runs the route mapping function.
|
||||
*
|
||||
* @param array $routing
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($routing = NULL)
|
||||
{
|
||||
$this->config =& load_class('Config', 'core');
|
||||
$this->uri =& load_class('URI', 'core');
|
||||
|
||||
$this->enable_query_strings = ( ! is_cli() && $this->config->item('enable_query_strings') === TRUE);
|
||||
|
||||
// If a directory override is configured, it has to be set before any dynamic routing logic
|
||||
is_array($routing) && isset($routing['directory']) && $this->set_directory($routing['directory']);
|
||||
$this->_set_routing();
|
||||
|
||||
// Set any routing overrides that may exist in the main index file
|
||||
if (is_array($routing))
|
||||
{
|
||||
empty($routing['controller']) OR $this->set_class($routing['controller']);
|
||||
empty($routing['function']) OR $this->set_method($routing['function']);
|
||||
}
|
||||
|
||||
log_message('info', 'Router Class Initialized');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set route mapping
|
||||
*
|
||||
* Determines what should be served based on the URI request,
|
||||
* as well as any "routes" that have been set in the routing config file.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _set_routing()
|
||||
{
|
||||
// Load the routes.php file. It would be great if we could
|
||||
// skip this for enable_query_strings = TRUE, but then
|
||||
// default_controller would be empty ...
|
||||
if (file_exists(APPPATH.'config/routes.php'))
|
||||
{
|
||||
include(APPPATH.'config/routes.php');
|
||||
}
|
||||
|
||||
if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/routes.php'))
|
||||
{
|
||||
include(APPPATH.'config/'.ENVIRONMENT.'/routes.php');
|
||||
}
|
||||
|
||||
// Validate & get reserved routes
|
||||
if (isset($route) && is_array($route))
|
||||
{
|
||||
isset($route['default_controller']) && $this->default_controller = $route['default_controller'];
|
||||
isset($route['translate_uri_dashes']) && $this->translate_uri_dashes = $route['translate_uri_dashes'];
|
||||
unset($route['default_controller'], $route['translate_uri_dashes']);
|
||||
$this->routes = $route;
|
||||
}
|
||||
|
||||
// Are query strings enabled in the config file? Normally CI doesn't utilize query strings
|
||||
// since URI segments are more search-engine friendly, but they can optionally be used.
|
||||
// If this feature is enabled, we will gather the directory/class/method a little differently
|
||||
if ($this->enable_query_strings)
|
||||
{
|
||||
// If the directory is set at this time, it means an override exists, so skip the checks
|
||||
if ( ! isset($this->directory))
|
||||
{
|
||||
$_d = $this->config->item('directory_trigger');
|
||||
$_d = isset($_GET[$_d]) ? trim($_GET[$_d], " \t\n\r\0\x0B/") : '';
|
||||
|
||||
if ($_d !== '')
|
||||
{
|
||||
$this->uri->filter_uri($_d);
|
||||
$this->set_directory($_d);
|
||||
}
|
||||
}
|
||||
|
||||
$_c = trim($this->config->item('controller_trigger'));
|
||||
if ( ! empty($_GET[$_c]))
|
||||
{
|
||||
$this->uri->filter_uri($_GET[$_c]);
|
||||
$this->set_class($_GET[$_c]);
|
||||
|
||||
$_f = trim($this->config->item('function_trigger'));
|
||||
if ( ! empty($_GET[$_f]))
|
||||
{
|
||||
$this->uri->filter_uri($_GET[$_f]);
|
||||
$this->set_method($_GET[$_f]);
|
||||
}
|
||||
|
||||
$this->uri->rsegments = array(
|
||||
1 => $this->class,
|
||||
2 => $this->method
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_set_default_controller();
|
||||
}
|
||||
|
||||
// Routing rules don't apply to query strings and we don't need to detect
|
||||
// directories, so we're done here
|
||||
return;
|
||||
}
|
||||
|
||||
// Is there anything to parse?
|
||||
if ($this->uri->uri_string !== '')
|
||||
{
|
||||
$this->_parse_routes();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_set_default_controller();
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set request route
|
||||
*
|
||||
* Takes an array of URI segments as input and sets the class/method
|
||||
* to be called.
|
||||
*
|
||||
* @used-by CI_Router::_parse_routes()
|
||||
* @param array $segments URI segments
|
||||
* @return void
|
||||
*/
|
||||
protected function _set_request($segments = array())
|
||||
{
|
||||
$segments = $this->_validate_request($segments);
|
||||
// If we don't have any segments left - try the default controller;
|
||||
// WARNING: Directories get shifted out of the segments array!
|
||||
if (empty($segments))
|
||||
{
|
||||
$this->_set_default_controller();
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->translate_uri_dashes === TRUE)
|
||||
{
|
||||
$segments[0] = str_replace('-', '_', $segments[0]);
|
||||
if (isset($segments[1]))
|
||||
{
|
||||
$segments[1] = str_replace('-', '_', $segments[1]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->set_class($segments[0]);
|
||||
if (isset($segments[1]))
|
||||
{
|
||||
$this->set_method($segments[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$segments[1] = 'index';
|
||||
}
|
||||
|
||||
array_unshift($segments, NULL);
|
||||
unset($segments[0]);
|
||||
$this->uri->rsegments = $segments;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set default controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _set_default_controller()
|
||||
{
|
||||
if (empty($this->default_controller))
|
||||
{
|
||||
show_error('Unable to determine what should be displayed. A default route has not been specified in the routing file.');
|
||||
}
|
||||
|
||||
// Is the method being specified?
|
||||
if (sscanf($this->default_controller, '%[^/]/%s', $class, $method) !== 2)
|
||||
{
|
||||
$method = 'index';
|
||||
}
|
||||
|
||||
if ( ! file_exists(APPPATH.'controllers/'.$this->directory.ucfirst($class).'.php'))
|
||||
{
|
||||
// This will trigger 404 later
|
||||
return;
|
||||
}
|
||||
|
||||
$this->set_class($class);
|
||||
$this->set_method($method);
|
||||
|
||||
// Assign routed segments, index starting from 1
|
||||
$this->uri->rsegments = array(
|
||||
1 => $class,
|
||||
2 => $method
|
||||
);
|
||||
|
||||
log_message('debug', 'No URI present. Default controller set.');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Validate request
|
||||
*
|
||||
* Attempts validate the URI request and determine the controller path.
|
||||
*
|
||||
* @used-by CI_Router::_set_request()
|
||||
* @param array $segments URI segments
|
||||
* @return mixed URI segments
|
||||
*/
|
||||
protected function _validate_request($segments)
|
||||
{
|
||||
$c = count($segments);
|
||||
$directory_override = isset($this->directory);
|
||||
|
||||
// Loop through our segments and return as soon as a controller
|
||||
// is found or when such a directory doesn't exist
|
||||
while ($c-- > 0)
|
||||
{
|
||||
$test = $this->directory
|
||||
.ucfirst($this->translate_uri_dashes === TRUE ? str_replace('-', '_', $segments[0]) : $segments[0]);
|
||||
|
||||
if ( ! file_exists(APPPATH.'controllers/'.$test.'.php')
|
||||
&& $directory_override === FALSE
|
||||
&& is_dir(APPPATH.'controllers/'.$this->directory.$segments[0])
|
||||
)
|
||||
{
|
||||
$this->set_directory(array_shift($segments), TRUE);
|
||||
continue;
|
||||
}
|
||||
|
||||
return $segments;
|
||||
}
|
||||
|
||||
// This means that all segments were actually directories
|
||||
return $segments;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Parse Routes
|
||||
*
|
||||
* Matches any routes that may exist in the config/routes.php file
|
||||
* against the URI to determine if the class/method need to be remapped.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _parse_routes()
|
||||
{
|
||||
// Turn the segment array into a URI string
|
||||
$uri = implode('/', $this->uri->segments);
|
||||
|
||||
// Get HTTP verb
|
||||
$http_verb = isset($_SERVER['REQUEST_METHOD']) ? strtolower($_SERVER['REQUEST_METHOD']) : 'cli';
|
||||
|
||||
// Loop through the route array looking for wildcards
|
||||
foreach ($this->routes as $key => $val)
|
||||
{
|
||||
// Check if route format is using HTTP verbs
|
||||
if (is_array($val))
|
||||
{
|
||||
$val = array_change_key_case($val, CASE_LOWER);
|
||||
if (isset($val[$http_verb]))
|
||||
{
|
||||
$val = $val[$http_verb];
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert wildcards to RegEx
|
||||
$key = str_replace(array(':any', ':num'), array('[^/]+', '[0-9]+'), $key);
|
||||
|
||||
// Does the RegEx match?
|
||||
if (preg_match('#^'.$key.'$#', $uri, $matches))
|
||||
{
|
||||
// Are we using callbacks to process back-references?
|
||||
if ( ! is_string($val) && is_callable($val))
|
||||
{
|
||||
// Remove the original string from the matches array.
|
||||
array_shift($matches);
|
||||
|
||||
// Execute the callback using the values in matches as its parameters.
|
||||
$val = call_user_func_array($val, $matches);
|
||||
}
|
||||
// Are we using the default routing method for back-references?
|
||||
elseif (strpos($val, '$') !== FALSE && strpos($key, '(') !== FALSE)
|
||||
{
|
||||
$val = preg_replace('#^'.$key.'$#', $val, $uri);
|
||||
}
|
||||
|
||||
$this->_set_request(explode('/', $val));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If we got this far it means we didn't encounter a
|
||||
// matching route so we'll set the site default route
|
||||
$this->_set_request(array_values($this->uri->segments));
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set class name
|
||||
*
|
||||
* @param string $class Class name
|
||||
* @return void
|
||||
*/
|
||||
public function set_class($class)
|
||||
{
|
||||
$this->class = str_replace(array('/', '.'), '', $class);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch the current class
|
||||
*
|
||||
* @deprecated 3.0.0 Read the 'class' property instead
|
||||
* @return string
|
||||
*/
|
||||
public function fetch_class()
|
||||
{
|
||||
return $this->class;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set method name
|
||||
*
|
||||
* @param string $method Method name
|
||||
* @return void
|
||||
*/
|
||||
public function set_method($method)
|
||||
{
|
||||
$this->method = $method;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch the current method
|
||||
*
|
||||
* @deprecated 3.0.0 Read the 'method' property instead
|
||||
* @return string
|
||||
*/
|
||||
public function fetch_method()
|
||||
{
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set directory name
|
||||
*
|
||||
* @param string $dir Directory name
|
||||
* @param bool $append Whether we're appending rather than setting the full value
|
||||
* @return void
|
||||
*/
|
||||
public function set_directory($dir, $append = FALSE)
|
||||
{
|
||||
if ($append !== TRUE OR empty($this->directory))
|
||||
{
|
||||
$this->directory = str_replace('.', '', trim($dir, '/')).'/';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->directory .= str_replace('.', '', trim($dir, '/')).'/';
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch directory
|
||||
*
|
||||
* Feches the sub-directory (if any) that contains the requested
|
||||
* controller class.
|
||||
*
|
||||
* @deprecated 3.0.0 Read the 'directory' property instead
|
||||
* @return string
|
||||
*/
|
||||
public function fetch_directory()
|
||||
{
|
||||
return $this->directory;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,644 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* URI Class
|
||||
*
|
||||
* Parses URIs and determines routing
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Libraries
|
||||
* @category URI
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/userguide3/libraries/uri.html
|
||||
*/
|
||||
class CI_URI {
|
||||
|
||||
/**
|
||||
* List of cached URI segments
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $keyval = array();
|
||||
|
||||
/**
|
||||
* Current URI string
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $uri_string = '';
|
||||
|
||||
/**
|
||||
* List of URI segments
|
||||
*
|
||||
* Starts at 1 instead of 0.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $segments = array();
|
||||
|
||||
/**
|
||||
* List of routed URI segments
|
||||
*
|
||||
* Starts at 1 instead of 0.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $rsegments = array();
|
||||
|
||||
/**
|
||||
* Permitted URI chars
|
||||
*
|
||||
* PCRE character group allowed in URI segments
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_permitted_uri_chars;
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->config =& load_class('Config', 'core');
|
||||
|
||||
// If query strings are enabled, we don't need to parse any segments.
|
||||
// However, they don't make sense under CLI.
|
||||
if (is_cli() OR $this->config->item('enable_query_strings') !== TRUE)
|
||||
{
|
||||
$this->_permitted_uri_chars = $this->config->item('permitted_uri_chars');
|
||||
|
||||
// If it's a CLI request, ignore the configuration
|
||||
if (is_cli())
|
||||
{
|
||||
$uri = $this->_parse_argv();
|
||||
}
|
||||
else
|
||||
{
|
||||
$protocol = $this->config->item('uri_protocol');
|
||||
empty($protocol) && $protocol = 'REQUEST_URI';
|
||||
|
||||
switch ($protocol)
|
||||
{
|
||||
case 'AUTO': // For BC purposes only
|
||||
case 'REQUEST_URI':
|
||||
$uri = $this->_parse_request_uri();
|
||||
break;
|
||||
case 'QUERY_STRING':
|
||||
$uri = $this->_parse_query_string();
|
||||
break;
|
||||
case 'PATH_INFO':
|
||||
default:
|
||||
$uri = isset($_SERVER[$protocol])
|
||||
? $_SERVER[$protocol]
|
||||
: $this->_parse_request_uri();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_set_uri_string($uri);
|
||||
}
|
||||
|
||||
log_message('info', 'URI Class Initialized');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set URI String
|
||||
*
|
||||
* @param string $str
|
||||
* @return void
|
||||
*/
|
||||
protected function _set_uri_string($str)
|
||||
{
|
||||
// Filter out control characters and trim slashes
|
||||
$this->uri_string = trim(remove_invisible_characters($str, FALSE), '/');
|
||||
|
||||
if ($this->uri_string !== '')
|
||||
{
|
||||
// Remove the URL suffix, if present
|
||||
if (($suffix = (string) $this->config->item('url_suffix')) !== '')
|
||||
{
|
||||
$slen = strlen($suffix);
|
||||
|
||||
if (substr($this->uri_string, -$slen) === $suffix)
|
||||
{
|
||||
$this->uri_string = substr($this->uri_string, 0, -$slen);
|
||||
}
|
||||
}
|
||||
|
||||
$this->segments[0] = NULL;
|
||||
// Populate the segments array
|
||||
foreach (explode('/', trim($this->uri_string, '/')) as $val)
|
||||
{
|
||||
$val = trim($val);
|
||||
// Filter segments for security
|
||||
$this->filter_uri($val);
|
||||
|
||||
if ($val !== '')
|
||||
{
|
||||
$this->segments[] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
unset($this->segments[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Parse REQUEST_URI
|
||||
*
|
||||
* Will parse REQUEST_URI and automatically detect the URI from it,
|
||||
* while fixing the query string if necessary.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _parse_request_uri()
|
||||
{
|
||||
if ( ! isset($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME']))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
// parse_url() returns false if no host is present, but the path or query string
|
||||
// contains a colon followed by a number
|
||||
$uri = parse_url('http://dummy'.$_SERVER['REQUEST_URI']);
|
||||
$query = isset($uri['query']) ? $uri['query'] : '';
|
||||
$uri = isset($uri['path']) ? $uri['path'] : '';
|
||||
|
||||
if (isset($_SERVER['SCRIPT_NAME'][0]))
|
||||
{
|
||||
if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0)
|
||||
{
|
||||
$uri = (string) substr($uri, strlen($_SERVER['SCRIPT_NAME']));
|
||||
}
|
||||
elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0)
|
||||
{
|
||||
$uri = (string) substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME'])));
|
||||
}
|
||||
}
|
||||
|
||||
// This section ensures that even on servers that require the URI to be in the query string (Nginx) a correct
|
||||
// URI is found, and also fixes the QUERY_STRING server var and $_GET array.
|
||||
if (trim($uri, '/') === '' && strncmp($query, '/', 1) === 0)
|
||||
{
|
||||
$query = explode('?', $query, 2);
|
||||
$uri = $query[0];
|
||||
$_SERVER['QUERY_STRING'] = isset($query[1]) ? $query[1] : '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$_SERVER['QUERY_STRING'] = $query;
|
||||
}
|
||||
|
||||
parse_str($_SERVER['QUERY_STRING'], $_GET);
|
||||
|
||||
if ($uri === '/' OR $uri === '')
|
||||
{
|
||||
return '/';
|
||||
}
|
||||
|
||||
// Do some final cleaning of the URI and return it
|
||||
return $this->_remove_relative_directory($uri);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Parse QUERY_STRING
|
||||
*
|
||||
* Will parse QUERY_STRING and automatically detect the URI from it.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _parse_query_string()
|
||||
{
|
||||
$uri = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING');
|
||||
|
||||
if (trim($uri, '/') === '')
|
||||
{
|
||||
return '';
|
||||
}
|
||||
elseif (strncmp($uri, '/', 1) === 0)
|
||||
{
|
||||
$uri = explode('?', $uri, 2);
|
||||
$_SERVER['QUERY_STRING'] = isset($uri[1]) ? $uri[1] : '';
|
||||
$uri = $uri[0];
|
||||
}
|
||||
|
||||
parse_str($_SERVER['QUERY_STRING'], $_GET);
|
||||
|
||||
return $this->_remove_relative_directory($uri);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Parse CLI arguments
|
||||
*
|
||||
* Take each command line argument and assume it is a URI segment.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _parse_argv()
|
||||
{
|
||||
$args = array_slice($_SERVER['argv'], 1);
|
||||
return $args ? implode('/', $args) : '';
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Remove relative directory (../) and multi slashes (///)
|
||||
*
|
||||
* Do some final cleaning of the URI and return it, currently only used in self::_parse_request_uri()
|
||||
*
|
||||
* @param string $uri
|
||||
* @return string
|
||||
*/
|
||||
protected function _remove_relative_directory($uri)
|
||||
{
|
||||
$uris = array();
|
||||
$tok = strtok($uri, '/');
|
||||
while ($tok !== FALSE)
|
||||
{
|
||||
if (( ! empty($tok) OR $tok === '0') && $tok !== '..')
|
||||
{
|
||||
$uris[] = $tok;
|
||||
}
|
||||
$tok = strtok('/');
|
||||
}
|
||||
|
||||
return implode('/', $uris);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Filter URI
|
||||
*
|
||||
* Filters segments for malicious characters.
|
||||
*
|
||||
* @param string $str
|
||||
* @return void
|
||||
*/
|
||||
public function filter_uri(&$str)
|
||||
{
|
||||
if ( ! empty($str) && ! empty($this->_permitted_uri_chars) && ! preg_match('/^['.$this->_permitted_uri_chars.']+$/i'.(UTF8_ENABLED ? 'u' : ''), $str))
|
||||
{
|
||||
show_error('The URI you submitted has disallowed characters.', 400);
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch URI Segment
|
||||
*
|
||||
* @see CI_URI::$segments
|
||||
* @param int $n Index
|
||||
* @param mixed $no_result What to return if the segment index is not found
|
||||
* @return mixed
|
||||
*/
|
||||
public function segment($n, $no_result = NULL)
|
||||
{
|
||||
return isset($this->segments[$n]) ? $this->segments[$n] : $no_result;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch URI "routed" Segment
|
||||
*
|
||||
* Returns the re-routed URI segment (assuming routing rules are used)
|
||||
* based on the index provided. If there is no routing, will return
|
||||
* the same result as CI_URI::segment().
|
||||
*
|
||||
* @see CI_URI::$rsegments
|
||||
* @see CI_URI::segment()
|
||||
* @param int $n Index
|
||||
* @param mixed $no_result What to return if the segment index is not found
|
||||
* @return mixed
|
||||
*/
|
||||
public function rsegment($n, $no_result = NULL)
|
||||
{
|
||||
return isset($this->rsegments[$n]) ? $this->rsegments[$n] : $no_result;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* URI to assoc
|
||||
*
|
||||
* Generates an associative array of URI data starting at the supplied
|
||||
* segment index. For example, if this is your URI:
|
||||
*
|
||||
* example.com/user/search/name/joe/location/UK/gender/male
|
||||
*
|
||||
* You can use this method to generate an array with this prototype:
|
||||
*
|
||||
* array (
|
||||
* name => joe
|
||||
* location => UK
|
||||
* gender => male
|
||||
* )
|
||||
*
|
||||
* @param int $n Index (default: 3)
|
||||
* @param array $default Default values
|
||||
* @return array
|
||||
*/
|
||||
public function uri_to_assoc($n = 3, $default = array())
|
||||
{
|
||||
return $this->_uri_to_assoc($n, $default, 'segment');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Routed URI to assoc
|
||||
*
|
||||
* Identical to CI_URI::uri_to_assoc(), only it uses the re-routed
|
||||
* segment array.
|
||||
*
|
||||
* @see CI_URI::uri_to_assoc()
|
||||
* @param int $n Index (default: 3)
|
||||
* @param array $default Default values
|
||||
* @return array
|
||||
*/
|
||||
public function ruri_to_assoc($n = 3, $default = array())
|
||||
{
|
||||
return $this->_uri_to_assoc($n, $default, 'rsegment');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Internal URI-to-assoc
|
||||
*
|
||||
* Generates a key/value pair from the URI string or re-routed URI string.
|
||||
*
|
||||
* @used-by CI_URI::uri_to_assoc()
|
||||
* @used-by CI_URI::ruri_to_assoc()
|
||||
* @param int $n Index (default: 3)
|
||||
* @param array $default Default values
|
||||
* @param string $which Array name ('segment' or 'rsegment')
|
||||
* @return array
|
||||
*/
|
||||
protected function _uri_to_assoc($n = 3, $default = array(), $which = 'segment')
|
||||
{
|
||||
if ( ! is_numeric($n))
|
||||
{
|
||||
return $default;
|
||||
}
|
||||
|
||||
if (isset($this->keyval[$which], $this->keyval[$which][$n]))
|
||||
{
|
||||
return $this->keyval[$which][$n];
|
||||
}
|
||||
|
||||
$total_segments = "total_{$which}s";
|
||||
$segment_array = "{$which}_array";
|
||||
|
||||
if ($this->$total_segments() < $n)
|
||||
{
|
||||
return (count($default) === 0)
|
||||
? array()
|
||||
: array_fill_keys($default, NULL);
|
||||
}
|
||||
|
||||
$segments = array_slice($this->$segment_array(), ($n - 1));
|
||||
$i = 0;
|
||||
$lastval = '';
|
||||
$retval = array();
|
||||
foreach ($segments as $seg)
|
||||
{
|
||||
if ($i % 2)
|
||||
{
|
||||
$retval[$lastval] = $seg;
|
||||
}
|
||||
else
|
||||
{
|
||||
$retval[$seg] = NULL;
|
||||
$lastval = $seg;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (count($default) > 0)
|
||||
{
|
||||
foreach ($default as $val)
|
||||
{
|
||||
if ( ! array_key_exists($val, $retval))
|
||||
{
|
||||
$retval[$val] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cache the array for reuse
|
||||
isset($this->keyval[$which]) OR $this->keyval[$which] = array();
|
||||
$this->keyval[$which][$n] = $retval;
|
||||
return $retval;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Assoc to URI
|
||||
*
|
||||
* Generates a URI string from an associative array.
|
||||
*
|
||||
* @param array $array Input array of key/value pairs
|
||||
* @return string URI string
|
||||
*/
|
||||
public function assoc_to_uri($array)
|
||||
{
|
||||
$temp = array();
|
||||
foreach ((array) $array as $key => $val)
|
||||
{
|
||||
$temp[] = $key;
|
||||
$temp[] = $val;
|
||||
}
|
||||
|
||||
return implode('/', $temp);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Slash segment
|
||||
*
|
||||
* Fetches an URI segment with a slash.
|
||||
*
|
||||
* @param int $n Index
|
||||
* @param string $where Where to add the slash ('trailing' or 'leading')
|
||||
* @return string
|
||||
*/
|
||||
public function slash_segment($n, $where = 'trailing')
|
||||
{
|
||||
return $this->_slash_segment($n, $where, 'segment');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Slash routed segment
|
||||
*
|
||||
* Fetches an URI routed segment with a slash.
|
||||
*
|
||||
* @param int $n Index
|
||||
* @param string $where Where to add the slash ('trailing' or 'leading')
|
||||
* @return string
|
||||
*/
|
||||
public function slash_rsegment($n, $where = 'trailing')
|
||||
{
|
||||
return $this->_slash_segment($n, $where, 'rsegment');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Internal Slash segment
|
||||
*
|
||||
* Fetches an URI Segment and adds a slash to it.
|
||||
*
|
||||
* @used-by CI_URI::slash_segment()
|
||||
* @used-by CI_URI::slash_rsegment()
|
||||
*
|
||||
* @param int $n Index
|
||||
* @param string $where Where to add the slash ('trailing' or 'leading')
|
||||
* @param string $which Array name ('segment' or 'rsegment')
|
||||
* @return string
|
||||
*/
|
||||
protected function _slash_segment($n, $where = 'trailing', $which = 'segment')
|
||||
{
|
||||
$leading = $trailing = '/';
|
||||
|
||||
if ($where === 'trailing')
|
||||
{
|
||||
$leading = '';
|
||||
}
|
||||
elseif ($where === 'leading')
|
||||
{
|
||||
$trailing = '';
|
||||
}
|
||||
|
||||
return $leading.$this->$which($n).$trailing;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Segment Array
|
||||
*
|
||||
* @return array CI_URI::$segments
|
||||
*/
|
||||
public function segment_array()
|
||||
{
|
||||
return $this->segments;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Routed Segment Array
|
||||
*
|
||||
* @return array CI_URI::$rsegments
|
||||
*/
|
||||
public function rsegment_array()
|
||||
{
|
||||
return $this->rsegments;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Total number of segments
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function total_segments()
|
||||
{
|
||||
return count($this->segments);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Total number of routed segments
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function total_rsegments()
|
||||
{
|
||||
return count($this->rsegments);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch URI string
|
||||
*
|
||||
* @return string CI_URI::$uri_string
|
||||
*/
|
||||
public function uri_string()
|
||||
{
|
||||
return $this->uri_string;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch Re-routed URI string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function ruri_string()
|
||||
{
|
||||
return ltrim(load_class('Router', 'core')->directory, '/').implode('/', $this->rsegments);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 2.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Utf8 Class
|
||||
*
|
||||
* Provides support for UTF-8 environments
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Libraries
|
||||
* @category UTF-8
|
||||
* @author EllisLab Dev Team
|
||||
* @link https://codeigniter.com/userguide3/libraries/utf8.html
|
||||
*/
|
||||
class CI_Utf8 {
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* Determines if UTF-8 support is to be enabled.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
if (
|
||||
defined('PREG_BAD_UTF8_ERROR') // PCRE must support UTF-8
|
||||
&& (ICONV_ENABLED === TRUE OR MB_ENABLED === TRUE) // iconv or mbstring must be installed
|
||||
&& strtoupper(config_item('charset')) === 'UTF-8' // Application charset must be UTF-8
|
||||
)
|
||||
{
|
||||
define('UTF8_ENABLED', TRUE);
|
||||
log_message('debug', 'UTF-8 Support Enabled');
|
||||
}
|
||||
else
|
||||
{
|
||||
define('UTF8_ENABLED', FALSE);
|
||||
log_message('debug', 'UTF-8 Support Disabled');
|
||||
}
|
||||
|
||||
log_message('info', 'Utf8 Class Initialized');
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Clean UTF-8 strings
|
||||
*
|
||||
* Ensures strings contain only valid UTF-8 characters.
|
||||
*
|
||||
* @param string $str String to clean
|
||||
* @return string
|
||||
*/
|
||||
public function clean_string($str)
|
||||
{
|
||||
if ($this->is_ascii($str) === FALSE)
|
||||
{
|
||||
if (MB_ENABLED)
|
||||
{
|
||||
$str = mb_convert_encoding($str, 'UTF-8', 'UTF-8');
|
||||
}
|
||||
elseif (ICONV_ENABLED)
|
||||
{
|
||||
$str = @iconv('UTF-8', 'UTF-8//IGNORE', $str);
|
||||
}
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Remove ASCII control characters
|
||||
*
|
||||
* Removes all ASCII control characters except horizontal tabs,
|
||||
* line feeds, and carriage returns, as all others can cause
|
||||
* problems in XML.
|
||||
*
|
||||
* @param string $str String to clean
|
||||
* @return string
|
||||
*/
|
||||
public function safe_ascii_for_xml($str)
|
||||
{
|
||||
return remove_invisible_characters($str, FALSE);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Convert to UTF-8
|
||||
*
|
||||
* Attempts to convert a string to UTF-8.
|
||||
*
|
||||
* @param string $str Input string
|
||||
* @param string $encoding Input encoding
|
||||
* @return string $str encoded in UTF-8 or FALSE on failure
|
||||
*/
|
||||
public function convert_to_utf8($str, $encoding)
|
||||
{
|
||||
if (MB_ENABLED)
|
||||
{
|
||||
return mb_convert_encoding($str, 'UTF-8', $encoding);
|
||||
}
|
||||
elseif (ICONV_ENABLED)
|
||||
{
|
||||
return @iconv($encoding, 'UTF-8', $str);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Is ASCII?
|
||||
*
|
||||
* Tests if a string is standard 7-bit ASCII or not.
|
||||
*
|
||||
* @param string $str String to check
|
||||
* @return bool
|
||||
*/
|
||||
public function is_ascii($str)
|
||||
{
|
||||
return (preg_match('/[^\x00-\x7F]/S', $str) === 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* PHP ext/hash compatibility package
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage CodeIgniter
|
||||
* @category Compatibility
|
||||
* @author Andrey Andreev
|
||||
* @link https://codeigniter.com/userguide3/
|
||||
* @link https://secure.php.net/hash
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (is_php('5.6'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('hash_equals'))
|
||||
{
|
||||
/**
|
||||
* hash_equals()
|
||||
*
|
||||
* @link http://php.net/hash_equals
|
||||
* @param string $known_string
|
||||
* @param string $user_string
|
||||
* @return bool
|
||||
*/
|
||||
function hash_equals($known_string, $user_string)
|
||||
{
|
||||
if ( ! is_string($known_string))
|
||||
{
|
||||
trigger_error('hash_equals(): Expected known_string to be a string, '.strtolower(gettype($known_string)).' given', E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
elseif ( ! is_string($user_string))
|
||||
{
|
||||
trigger_error('hash_equals(): Expected user_string to be a string, '.strtolower(gettype($user_string)).' given', E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
elseif (($length = strlen($known_string)) !== strlen($user_string))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$diff = 0;
|
||||
for ($i = 0; $i < $length; $i++)
|
||||
{
|
||||
$diff |= ord($known_string[$i]) ^ ord($user_string[$i]);
|
||||
}
|
||||
|
||||
return ($diff === 0);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (is_php('5.5'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('hash_pbkdf2'))
|
||||
{
|
||||
/**
|
||||
* hash_pbkdf2()
|
||||
*
|
||||
* @link http://php.net/hash_pbkdf2
|
||||
* @param string $algo
|
||||
* @param string $password
|
||||
* @param string $salt
|
||||
* @param int $iterations
|
||||
* @param int $length
|
||||
* @param bool $raw_output
|
||||
* @return string
|
||||
*/
|
||||
function hash_pbkdf2($algo, $password, $salt, $iterations, $length = 0, $raw_output = FALSE)
|
||||
{
|
||||
if ( ! in_array(strtolower($algo), hash_algos(), TRUE))
|
||||
{
|
||||
trigger_error('hash_pbkdf2(): Unknown hashing algorithm: '.$algo, E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (($type = gettype($iterations)) !== 'integer')
|
||||
{
|
||||
if ($type === 'object' && method_exists($iterations, '__toString'))
|
||||
{
|
||||
$iterations = (string) $iterations;
|
||||
}
|
||||
|
||||
if (is_string($iterations) && is_numeric($iterations))
|
||||
{
|
||||
$iterations = (int) $iterations;
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error('hash_pbkdf2() expects parameter 4 to be long, '.$type.' given', E_USER_WARNING);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ($iterations < 1)
|
||||
{
|
||||
trigger_error('hash_pbkdf2(): Iterations must be a positive integer: '.$iterations, E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (($type = gettype($length)) !== 'integer')
|
||||
{
|
||||
if ($type === 'object' && method_exists($length, '__toString'))
|
||||
{
|
||||
$length = (string) $length;
|
||||
}
|
||||
|
||||
if (is_string($length) && is_numeric($length))
|
||||
{
|
||||
$length = (int) $length;
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error('hash_pbkdf2() expects parameter 5 to be long, '.$type.' given', E_USER_WARNING);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ($length < 0)
|
||||
{
|
||||
trigger_error('hash_pbkdf2(): Length must be greater than or equal to 0: '.$length, E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$hash_length = defined('MB_OVERLOAD_STRING')
|
||||
? mb_strlen(hash($algo, NULL, TRUE), '8bit')
|
||||
: strlen(hash($algo, NULL, TRUE));
|
||||
empty($length) && $length = $hash_length;
|
||||
|
||||
// Pre-hash password inputs longer than the algorithm's block size
|
||||
// (i.e. prepare HMAC key) to mitigate potential DoS attacks.
|
||||
static $block_sizes;
|
||||
empty($block_sizes) && $block_sizes = array(
|
||||
'gost' => 32,
|
||||
'haval128,3' => 128,
|
||||
'haval160,3' => 128,
|
||||
'haval192,3' => 128,
|
||||
'haval224,3' => 128,
|
||||
'haval256,3' => 128,
|
||||
'haval128,4' => 128,
|
||||
'haval160,4' => 128,
|
||||
'haval192,4' => 128,
|
||||
'haval224,4' => 128,
|
||||
'haval256,4' => 128,
|
||||
'haval128,5' => 128,
|
||||
'haval160,5' => 128,
|
||||
'haval192,5' => 128,
|
||||
'haval224,5' => 128,
|
||||
'haval256,5' => 128,
|
||||
'md2' => 16,
|
||||
'md4' => 64,
|
||||
'md5' => 64,
|
||||
'ripemd128' => 64,
|
||||
'ripemd160' => 64,
|
||||
'ripemd256' => 64,
|
||||
'ripemd320' => 64,
|
||||
'salsa10' => 64,
|
||||
'salsa20' => 64,
|
||||
'sha1' => 64,
|
||||
'sha224' => 64,
|
||||
'sha256' => 64,
|
||||
'sha384' => 128,
|
||||
'sha512' => 128,
|
||||
'snefru' => 32,
|
||||
'snefru256' => 32,
|
||||
'tiger128,3' => 64,
|
||||
'tiger160,3' => 64,
|
||||
'tiger192,3' => 64,
|
||||
'tiger128,4' => 64,
|
||||
'tiger160,4' => 64,
|
||||
'tiger192,4' => 64,
|
||||
'whirlpool' => 64
|
||||
);
|
||||
|
||||
if (isset($block_sizes[$algo], $password[$block_sizes[$algo]]))
|
||||
{
|
||||
$password = hash($algo, $password, TRUE);
|
||||
}
|
||||
|
||||
$hash = '';
|
||||
// Note: Blocks are NOT 0-indexed
|
||||
for ($bc = (int) ceil($length / $hash_length), $bi = 1; $bi <= $bc; $bi++)
|
||||
{
|
||||
$key = $derived_key = hash_hmac($algo, $salt.pack('N', $bi), $password, TRUE);
|
||||
for ($i = 1; $i < $iterations; $i++)
|
||||
{
|
||||
$derived_key ^= $key = hash_hmac($algo, $key, $password, TRUE);
|
||||
}
|
||||
|
||||
$hash .= $derived_key;
|
||||
}
|
||||
|
||||
// This is not RFC-compatible, but we're aiming for natural PHP compatibility
|
||||
if ( ! $raw_output)
|
||||
{
|
||||
$hash = bin2hex($hash);
|
||||
}
|
||||
|
||||
return defined('MB_OVERLOAD_STRING')
|
||||
? mb_substr($hash, 0, $length, '8bit')
|
||||
: substr($hash, 0, $length);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* PHP ext/mbstring compatibility package
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage CodeIgniter
|
||||
* @category Compatibility
|
||||
* @author Andrey Andreev
|
||||
* @link https://codeigniter.com/userguide3/
|
||||
* @link https://secure.php.net/mbstring
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (MB_ENABLED === TRUE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('mb_strlen'))
|
||||
{
|
||||
/**
|
||||
* mb_strlen()
|
||||
*
|
||||
* WARNING: This function WILL fall-back to strlen()
|
||||
* if iconv is not available!
|
||||
*
|
||||
* @link http://php.net/mb_strlen
|
||||
* @param string $str
|
||||
* @param string $encoding
|
||||
* @return int
|
||||
*/
|
||||
function mb_strlen($str, $encoding = NULL)
|
||||
{
|
||||
if (ICONV_ENABLED === TRUE)
|
||||
{
|
||||
return iconv_strlen($str, isset($encoding) ? $encoding : config_item('charset'));
|
||||
}
|
||||
|
||||
log_message('debug', 'Compatibility (mbstring): iconv_strlen() is not available, falling back to strlen().');
|
||||
return strlen($str);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('mb_strpos'))
|
||||
{
|
||||
/**
|
||||
* mb_strpos()
|
||||
*
|
||||
* WARNING: This function WILL fall-back to strpos()
|
||||
* if iconv is not available!
|
||||
*
|
||||
* @link http://php.net/mb_strpos
|
||||
* @param string $haystack
|
||||
* @param string $needle
|
||||
* @param int $offset
|
||||
* @param string $encoding
|
||||
* @return mixed
|
||||
*/
|
||||
function mb_strpos($haystack, $needle, $offset = 0, $encoding = NULL)
|
||||
{
|
||||
if (ICONV_ENABLED === TRUE)
|
||||
{
|
||||
return iconv_strpos($haystack, $needle, $offset, isset($encoding) ? $encoding : config_item('charset'));
|
||||
}
|
||||
|
||||
log_message('debug', 'Compatibility (mbstring): iconv_strpos() is not available, falling back to strpos().');
|
||||
return strpos($haystack, $needle, $offset);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('mb_substr'))
|
||||
{
|
||||
/**
|
||||
* mb_substr()
|
||||
*
|
||||
* WARNING: This function WILL fall-back to substr()
|
||||
* if iconv is not available.
|
||||
*
|
||||
* @link http://php.net/mb_substr
|
||||
* @param string $str
|
||||
* @param int $start
|
||||
* @param int $length
|
||||
* @param string $encoding
|
||||
* @return string
|
||||
*/
|
||||
function mb_substr($str, $start, $length = NULL, $encoding = NULL)
|
||||
{
|
||||
if (ICONV_ENABLED === TRUE)
|
||||
{
|
||||
isset($encoding) OR $encoding = config_item('charset');
|
||||
return iconv_substr(
|
||||
$str,
|
||||
$start,
|
||||
isset($length) ? $length : iconv_strlen($str, $encoding), // NULL doesn't work
|
||||
$encoding
|
||||
);
|
||||
}
|
||||
|
||||
log_message('debug', 'Compatibility (mbstring): iconv_substr() is not available, falling back to substr().');
|
||||
return isset($length)
|
||||
? substr($str, $start, $length)
|
||||
: substr($str, $start);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* PHP ext/standard/password compatibility package
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage CodeIgniter
|
||||
* @category Compatibility
|
||||
* @author Andrey Andreev
|
||||
* @link https://codeigniter.com/userguide3/
|
||||
* @link https://secure.php.net/password
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (is_php('5.5') OR ! defined('CRYPT_BLOWFISH') OR CRYPT_BLOWFISH !== 1 OR defined('HHVM_VERSION'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
defined('PASSWORD_BCRYPT') OR define('PASSWORD_BCRYPT', 1);
|
||||
defined('PASSWORD_DEFAULT') OR define('PASSWORD_DEFAULT', PASSWORD_BCRYPT);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('password_get_info'))
|
||||
{
|
||||
/**
|
||||
* password_get_info()
|
||||
*
|
||||
* @link http://php.net/password_get_info
|
||||
* @param string $hash
|
||||
* @return array
|
||||
*/
|
||||
function password_get_info($hash)
|
||||
{
|
||||
return (strlen($hash) < 60 OR sscanf($hash, '$2y$%d', $hash) !== 1)
|
||||
? array('algo' => 0, 'algoName' => 'unknown', 'options' => array())
|
||||
: array('algo' => 1, 'algoName' => 'bcrypt', 'options' => array('cost' => $hash));
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('password_hash'))
|
||||
{
|
||||
/**
|
||||
* password_hash()
|
||||
*
|
||||
* @link http://php.net/password_hash
|
||||
* @param string $password
|
||||
* @param int $algo
|
||||
* @param array $options
|
||||
* @return mixed
|
||||
*/
|
||||
function password_hash($password, $algo, array $options = array())
|
||||
{
|
||||
static $func_overload;
|
||||
isset($func_overload) OR $func_overload = (extension_loaded('mbstring') && ini_get('mbstring.func_overload'));
|
||||
|
||||
if ($algo !== 1)
|
||||
{
|
||||
trigger_error('password_hash(): Unknown hashing algorithm: '.(int) $algo, E_USER_WARNING);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (isset($options['cost']) && ($options['cost'] < 4 OR $options['cost'] > 31))
|
||||
{
|
||||
trigger_error('password_hash(): Invalid bcrypt cost parameter specified: '.(int) $options['cost'], E_USER_WARNING);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (isset($options['salt']) && ($saltlen = ($func_overload ? mb_strlen($options['salt'], '8bit') : strlen($options['salt']))) < 22)
|
||||
{
|
||||
trigger_error('password_hash(): Provided salt is too short: '.$saltlen.' expecting 22', E_USER_WARNING);
|
||||
return NULL;
|
||||
}
|
||||
elseif ( ! isset($options['salt']))
|
||||
{
|
||||
if (function_exists('random_bytes'))
|
||||
{
|
||||
try
|
||||
{
|
||||
$options['salt'] = random_bytes(16);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
log_message('error', 'compat/password: Error while trying to use random_bytes(): '.$e->getMessage());
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
elseif (defined('MCRYPT_DEV_URANDOM'))
|
||||
{
|
||||
$options['salt'] = mcrypt_create_iv(16, MCRYPT_DEV_URANDOM);
|
||||
}
|
||||
elseif (DIRECTORY_SEPARATOR === '/' && (is_readable($dev = '/dev/arandom') OR is_readable($dev = '/dev/urandom')))
|
||||
{
|
||||
if (($fp = fopen($dev, 'rb')) === FALSE)
|
||||
{
|
||||
log_message('error', 'compat/password: Unable to open '.$dev.' for reading.');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Try not to waste entropy ...
|
||||
is_php('5.4') && stream_set_chunk_size($fp, 16);
|
||||
|
||||
$options['salt'] = '';
|
||||
for ($read = 0; $read < 16; $read = ($func_overload) ? mb_strlen($options['salt'], '8bit') : strlen($options['salt']))
|
||||
{
|
||||
if (($read = fread($fp, 16 - $read)) === FALSE)
|
||||
{
|
||||
log_message('error', 'compat/password: Error while reading from '.$dev.'.');
|
||||
return FALSE;
|
||||
}
|
||||
$options['salt'] .= $read;
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
}
|
||||
elseif (function_exists('openssl_random_pseudo_bytes'))
|
||||
{
|
||||
$is_secure = NULL;
|
||||
$options['salt'] = openssl_random_pseudo_bytes(16, $is_secure);
|
||||
if ($is_secure !== TRUE)
|
||||
{
|
||||
log_message('error', 'compat/password: openssl_random_pseudo_bytes() set the $cryto_strong flag to FALSE');
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message('error', 'compat/password: No CSPRNG available.');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$options['salt'] = str_replace('+', '.', rtrim(base64_encode($options['salt']), '='));
|
||||
}
|
||||
elseif ( ! preg_match('#^[a-zA-Z0-9./]+$#D', $options['salt']))
|
||||
{
|
||||
$options['salt'] = str_replace('+', '.', rtrim(base64_encode($options['salt']), '='));
|
||||
}
|
||||
|
||||
isset($options['cost']) OR $options['cost'] = 10;
|
||||
|
||||
return (strlen($password = crypt($password, sprintf('$2y$%02d$%s', $options['cost'], $options['salt']))) === 60)
|
||||
? $password
|
||||
: FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('password_needs_rehash'))
|
||||
{
|
||||
/**
|
||||
* password_needs_rehash()
|
||||
*
|
||||
* @link http://php.net/password_needs_rehash
|
||||
* @param string $hash
|
||||
* @param int $algo
|
||||
* @param array $options
|
||||
* @return bool
|
||||
*/
|
||||
function password_needs_rehash($hash, $algo, array $options = array())
|
||||
{
|
||||
$info = password_get_info($hash);
|
||||
|
||||
if ($algo !== $info['algo'])
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
elseif ($algo === 1)
|
||||
{
|
||||
$options['cost'] = isset($options['cost']) ? (int) $options['cost'] : 10;
|
||||
return ($info['options']['cost'] !== $options['cost']);
|
||||
}
|
||||
|
||||
// Odd at first glance, but according to a comment in PHP's own unit tests,
|
||||
// because it is an unknown algorithm - it's valid and therefore doesn't
|
||||
// need rehashing.
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('password_verify'))
|
||||
{
|
||||
/**
|
||||
* password_verify()
|
||||
*
|
||||
* @link http://php.net/password_verify
|
||||
* @param string $password
|
||||
* @param string $hash
|
||||
* @return bool
|
||||
*/
|
||||
function password_verify($password, $hash)
|
||||
{
|
||||
if (strlen($hash) !== 60 OR strlen($password = crypt($password, $hash)) !== 60)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$compare = 0;
|
||||
for ($i = 0; $i < 60; $i++)
|
||||
{
|
||||
$compare |= (ord($password[$i]) ^ ord($hash[$i]));
|
||||
}
|
||||
|
||||
return ($compare === 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* PHP ext/standard compatibility package
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage CodeIgniter
|
||||
* @category Compatibility
|
||||
* @author Andrey Andreev
|
||||
* @link https://codeigniter.com/userguide3/
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (is_php('5.5'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('array_column'))
|
||||
{
|
||||
/**
|
||||
* array_column()
|
||||
*
|
||||
* @link http://php.net/array_column
|
||||
* @param array $array
|
||||
* @param mixed $column_key
|
||||
* @param mixed $index_key
|
||||
* @return array
|
||||
*/
|
||||
function array_column(array $array, $column_key, $index_key = NULL)
|
||||
{
|
||||
if ( ! in_array($type = gettype($column_key), array('integer', 'string', 'NULL'), TRUE))
|
||||
{
|
||||
if ($type === 'double')
|
||||
{
|
||||
$column_key = (int) $column_key;
|
||||
}
|
||||
elseif ($type === 'object' && method_exists($column_key, '__toString'))
|
||||
{
|
||||
$column_key = (string) $column_key;
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! in_array($type = gettype($index_key), array('integer', 'string', 'NULL'), TRUE))
|
||||
{
|
||||
if ($type === 'double')
|
||||
{
|
||||
$index_key = (int) $index_key;
|
||||
}
|
||||
elseif ($type === 'object' && method_exists($index_key, '__toString'))
|
||||
{
|
||||
$index_key = (string) $index_key;
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
$result = array();
|
||||
foreach ($array as &$a)
|
||||
{
|
||||
if ($column_key === NULL)
|
||||
{
|
||||
$value = $a;
|
||||
}
|
||||
elseif (is_array($a) && array_key_exists($column_key, $a))
|
||||
{
|
||||
$value = $a[$column_key];
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($index_key === NULL OR ! array_key_exists($index_key, $a))
|
||||
{
|
||||
$result[] = $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$result[$a[$index_key]] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (is_php('5.4'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('hex2bin'))
|
||||
{
|
||||
/**
|
||||
* hex2bin()
|
||||
*
|
||||
* @link http://php.net/hex2bin
|
||||
* @param string $data
|
||||
* @return string
|
||||
*/
|
||||
function hex2bin($data)
|
||||
{
|
||||
if (in_array($type = gettype($data), array('array', 'double', 'object', 'resource'), TRUE))
|
||||
{
|
||||
if ($type === 'object' && method_exists($data, '__toString'))
|
||||
{
|
||||
$data = (string) $data;
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error('hex2bin() expects parameter 1 to be string, '.$type.' given', E_USER_WARNING);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen($data) % 2 !== 0)
|
||||
{
|
||||
trigger_error('Hexadecimal input string must have an even length', E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
elseif ( ! preg_match('/^[0-9a-f]*$/i', $data))
|
||||
{
|
||||
trigger_error('Input string must be hexadecimal string', E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return pack('H*', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user