Implemented all basic features of WebComponent. Not release ready
This commit is contained in:
parent
e276a7ca29
commit
eda14348b0
|
@ -0,0 +1,197 @@
|
|||
<?php
|
||||
/**
|
||||
* FuzeWorks WebComponent.
|
||||
*
|
||||
* The FuzeWorks PHP FrameWork
|
||||
*
|
||||
* Copyright (C) 2013-2019 TechFuze
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author TechFuze
|
||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
*
|
||||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 1.2.0
|
||||
*
|
||||
* @version Version 1.2.0
|
||||
*/
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| MIME TYPES
|
||||
| -------------------------------------------------------------------
|
||||
| This file contains an array of mime types.
|
||||
*/
|
||||
return [
|
||||
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
|
||||
'cpt' => 'application/mac-compactpro',
|
||||
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
|
||||
'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
|
||||
'dms' => 'application/octet-stream',
|
||||
'lha' => 'application/octet-stream',
|
||||
'lzh' => 'application/octet-stream',
|
||||
'exe' => array('application/octet-stream', 'application/x-msdownload'),
|
||||
'class' => 'application/octet-stream',
|
||||
'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
|
||||
'so' => 'application/octet-stream',
|
||||
'sea' => 'application/octet-stream',
|
||||
'dll' => 'application/octet-stream',
|
||||
'oda' => 'application/oda',
|
||||
'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
|
||||
'ai' => array('application/pdf', 'application/postscript'),
|
||||
'eps' => 'application/postscript',
|
||||
'ps' => 'application/postscript',
|
||||
'smi' => 'application/smil',
|
||||
'smil' => 'application/smil',
|
||||
'mif' => 'application/vnd.mif',
|
||||
'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'),
|
||||
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
|
||||
'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
|
||||
'wbxml' => 'application/wbxml',
|
||||
'wmlc' => 'application/wmlc',
|
||||
'dcr' => 'application/x-director',
|
||||
'dir' => 'application/x-director',
|
||||
'dxr' => 'application/x-director',
|
||||
'dvi' => 'application/x-dvi',
|
||||
'gtar' => 'application/x-gtar',
|
||||
'gz' => 'application/x-gzip',
|
||||
'gzip' => 'application/x-gzip',
|
||||
'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'),
|
||||
'php4' => 'application/x-httpd-php',
|
||||
'php3' => 'application/x-httpd-php',
|
||||
'phtml' => 'application/x-httpd-php',
|
||||
'phps' => 'application/x-httpd-php-source',
|
||||
'js' => array('application/x-javascript', 'text/plain'),
|
||||
'swf' => 'application/x-shockwave-flash',
|
||||
'sit' => 'application/x-stuffit',
|
||||
'tar' => 'application/x-tar',
|
||||
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
|
||||
'z' => 'application/x-compress',
|
||||
'xhtml' => 'application/xhtml+xml',
|
||||
'xht' => 'application/xhtml+xml',
|
||||
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
|
||||
'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
|
||||
'mid' => 'audio/midi',
|
||||
'midi' => 'audio/midi',
|
||||
'mpga' => 'audio/mpeg',
|
||||
'mp2' => 'audio/mpeg',
|
||||
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
|
||||
'aif' => array('audio/x-aiff', 'audio/aiff'),
|
||||
'aiff' => array('audio/x-aiff', 'audio/aiff'),
|
||||
'aifc' => 'audio/x-aiff',
|
||||
'ram' => 'audio/x-pn-realaudio',
|
||||
'rm' => 'audio/x-pn-realaudio',
|
||||
'rpm' => 'audio/x-pn-realaudio-plugin',
|
||||
'ra' => 'audio/x-realaudio',
|
||||
'rv' => 'video/vnd.rn-realvideo',
|
||||
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
|
||||
'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'),
|
||||
'gif' => 'image/gif',
|
||||
'jpeg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpe' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'png' => array('image/png', 'image/x-png'),
|
||||
'tiff' => 'image/tiff',
|
||||
'tif' => 'image/tiff',
|
||||
'css' => array('text/css', 'text/plain'),
|
||||
'html' => array('text/html', 'text/plain'),
|
||||
'htm' => array('text/html', 'text/plain'),
|
||||
'shtml' => array('text/html', 'text/plain'),
|
||||
'txt' => 'text/plain',
|
||||
'text' => 'text/plain',
|
||||
'log' => array('text/plain', 'text/x-log'),
|
||||
'rtx' => 'text/richtext',
|
||||
'rtf' => 'text/rtf',
|
||||
'xml' => array('application/xml', 'text/xml', 'text/plain'),
|
||||
'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
|
||||
'mpeg' => 'video/mpeg',
|
||||
'mpg' => 'video/mpeg',
|
||||
'mpe' => 'video/mpeg',
|
||||
'qt' => 'video/quicktime',
|
||||
'mov' => 'video/quicktime',
|
||||
'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
|
||||
'movie' => 'video/x-sgi-movie',
|
||||
'doc' => array('application/msword', 'application/vnd.ms-office'),
|
||||
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
|
||||
'dot' => array('application/msword', 'application/vnd.ms-office'),
|
||||
'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
|
||||
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'),
|
||||
'word' => array('application/msword', 'application/octet-stream'),
|
||||
'xl' => 'application/excel',
|
||||
'eml' => 'message/rfc822',
|
||||
'json' => array('application/json', 'text/json'),
|
||||
'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
|
||||
'p10' => array('application/x-pkcs10', 'application/pkcs10'),
|
||||
'p12' => 'application/x-pkcs12',
|
||||
'p7a' => 'application/x-pkcs7-signature',
|
||||
'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
|
||||
'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
|
||||
'p7r' => 'application/x-pkcs7-certreqresp',
|
||||
'p7s' => 'application/pkcs7-signature',
|
||||
'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
|
||||
'crl' => array('application/pkix-crl', 'application/pkcs-crl'),
|
||||
'der' => 'application/x-x509-ca-cert',
|
||||
'kdb' => 'application/octet-stream',
|
||||
'pgp' => 'application/pgp',
|
||||
'gpg' => 'application/gpg-keys',
|
||||
'sst' => 'application/octet-stream',
|
||||
'csr' => 'application/octet-stream',
|
||||
'rsa' => 'application/x-pkcs7',
|
||||
'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
|
||||
'3g2' => 'video/3gpp2',
|
||||
'3gp' => array('video/3gp', 'video/3gpp'),
|
||||
'mp4' => 'video/mp4',
|
||||
'm4a' => 'audio/x-m4a',
|
||||
'f4v' => array('video/mp4', 'video/x-f4v'),
|
||||
'flv' => 'video/x-flv',
|
||||
'webm' => 'video/webm',
|
||||
'aac' => 'audio/x-acc',
|
||||
'm4u' => 'application/vnd.mpegurl',
|
||||
'm3u' => 'text/plain',
|
||||
'xspf' => 'application/xspf+xml',
|
||||
'vlc' => 'application/videolan',
|
||||
'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'),
|
||||
'au' => 'audio/x-au',
|
||||
'ac3' => 'audio/ac3',
|
||||
'flac' => 'audio/x-flac',
|
||||
'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'),
|
||||
'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
|
||||
'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
|
||||
'ics' => 'text/calendar',
|
||||
'ical' => 'text/calendar',
|
||||
'zsh' => 'text/x-scriptzsh',
|
||||
'7zip' => array('application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
|
||||
'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
|
||||
'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
|
||||
'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
|
||||
'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
|
||||
'vcf' => 'text/x-vcard',
|
||||
'srt' => array('text/srt', 'text/plain'),
|
||||
'vtt' => array('text/vtt', 'text/plain'),
|
||||
'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon')
|
||||
];
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
/**
|
||||
* FuzeWorks WebComponent.
|
||||
*
|
||||
* The FuzeWorks PHP FrameWork
|
||||
*
|
||||
* Copyright (C) 2013-2019 TechFuze
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author TechFuze
|
||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
*
|
||||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 1.2.0
|
||||
*
|
||||
* @version Version 1.2.0
|
||||
*/
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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
|
||||
*/
|
||||
'csrf_protection' => false,
|
||||
'csrf_token_name' => 'fw_csrf_token',
|
||||
'csrf_cookie_name' => 'fw_csrf_cookie',
|
||||
'csrf_expire' => 7200,
|
||||
'csrf_regenerate' => TRUE,
|
||||
'csrf_exclude_uris' => array(),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Standardize newlines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determines whether to standardize newline characters in input data,
|
||||
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
||||
|
|
||||
| This is particularly useful for portability between UNIX-based OSes,
|
||||
| (usually \n) and Windows (\r\n).
|
||||
|
|
||||
*/
|
||||
'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!
|
||||
|
|
||||
*/
|
||||
'global_xss_filtering' => 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')
|
||||
*/
|
||||
'proxy_ips' => ''
|
||||
];
|
|
@ -36,5 +36,11 @@
|
|||
return [
|
||||
'allow_get_input' => true,
|
||||
'empty_global_arrays' => true,
|
||||
'restore_global_arrays' => true
|
||||
'restore_global_arrays' => true,
|
||||
'base_url' => '',
|
||||
'permitted_uri_chars' => 'a-z 0-9~%.:_\-',
|
||||
'charset' => 'UTF-8',
|
||||
'compress_output' => false,
|
||||
'cookie_prefix' => 'FWZ_',
|
||||
'xss_clean' => true
|
||||
];
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* FuzeWorks WebComponent.
|
||||
*
|
||||
* The FuzeWorks PHP FrameWork
|
||||
*
|
||||
* Copyright (C) 2013-2019 TechFuze
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author TechFuze
|
||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
*
|
||||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 1.2.0
|
||||
*
|
||||
* @version Version 1.2.0
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
||||
class OutputException extends Exception
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* FuzeWorks WebComponent.
|
||||
*
|
||||
* The FuzeWorks PHP FrameWork
|
||||
*
|
||||
* Copyright (C) 2013-2019 TechFuze
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author TechFuze
|
||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
*
|
||||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 1.2.0
|
||||
*
|
||||
* @version Version 1.2.0
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
||||
|
||||
class SecurityException extends Exception
|
||||
{
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* FuzeWorks WebComponent.
|
||||
*
|
||||
* The FuzeWorks PHP FrameWork
|
||||
*
|
||||
* Copyright (C) 2013-2019 TechFuze
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author TechFuze
|
||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
*
|
||||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 1.2.0
|
||||
*
|
||||
* @version Version 1.2.0
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
||||
class UriException extends Exception
|
||||
{
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* FuzeWorks WebComponent.
|
||||
*
|
||||
* The FuzeWorks PHP FrameWork
|
||||
*
|
||||
* Copyright (C) 2013-2019 TechFuze
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author TechFuze
|
||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
*
|
||||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 1.2.0
|
||||
*
|
||||
* @version Version 1.2.0
|
||||
*/
|
||||
|
||||
namespace FuzeWorks\Exception;
|
||||
|
||||
class WebException extends Exception
|
||||
{
|
||||
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
<?php /** @noinspection ALL */
|
||||
|
||||
/**
|
||||
* FuzeWorks WebComponent.
|
||||
*
|
||||
|
@ -37,7 +38,7 @@
|
|||
namespace FuzeWorks;
|
||||
|
||||
use FuzeWorks\ConfigORM\ConfigORM;
|
||||
use FuzeWorks\Event\NotifierEvent;
|
||||
use Tracy\Debugger;
|
||||
|
||||
class Input
|
||||
{
|
||||
|
@ -55,8 +56,16 @@ class Input
|
|||
*/
|
||||
protected $webConfig;
|
||||
|
||||
/**
|
||||
* @var Security
|
||||
*/
|
||||
private $security;
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Set dependencies first
|
||||
$this->security = Factory::getInstance()->security;
|
||||
|
||||
// Set the configuration
|
||||
$this->webConfig = Factory::getInstance()->config->getConfig('web');
|
||||
|
||||
|
@ -64,23 +73,58 @@ class Input
|
|||
$this->sanitizeGlobals();
|
||||
|
||||
if ($this->webConfig->get('empty_global_arrays') && $this->webConfig->get('restore_global_arrays'))
|
||||
{
|
||||
if (class_exists('\FuzeWorks\TracyComponent', true) && \FuzeWorks\TracyComponent::isEnabled())
|
||||
{
|
||||
set_exception_handler([$this, 'tracyExceptionHandler']);
|
||||
set_error_handler([$this, 'tracyErrorHandler']);
|
||||
}
|
||||
Events::addListener(
|
||||
array($this, 'restoreGlobalArrays'),
|
||||
'coreShutdownEvent', Priority::HIGH
|
||||
[$this, 'restoreGlobalArrays'],
|
||||
'coreShutdownEvent', Priority::HIGHEST
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function restoreGlobalArrays(NotifierEvent $event)
|
||||
/**
|
||||
* Used to restore global arrays before handling errors by Tracy
|
||||
*
|
||||
* @param $exception
|
||||
* @param bool $exit
|
||||
* @internal
|
||||
*/
|
||||
public function tracyExceptionHandler($exception, $exit = true)
|
||||
{
|
||||
$this->restoreGlobalArrays();
|
||||
Debugger::exceptionHandler($exception, $exit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to restore global arrays before handling errors by Tracy
|
||||
*
|
||||
* @param $severity
|
||||
* @param $message
|
||||
* @param $file
|
||||
* @param $line
|
||||
* @param array $context
|
||||
* @throws \ErrorException
|
||||
* @internal
|
||||
*/
|
||||
public function tracyErrorHandler($severity, $message, $file, $line, $context = [])
|
||||
{
|
||||
$this->restoreGlobalArrays();
|
||||
Debugger::errorHandler($severity, $message, $file, $line, $context);
|
||||
}
|
||||
|
||||
public function restoreGlobalArrays()
|
||||
{
|
||||
Logger::logInfo('Restoring global $_GET, $_POST, $_SERVER, $_COOKIE arrays');
|
||||
$_GET = $this->inputArray['get'];
|
||||
$_POST = $this->inputArray['post'];
|
||||
$_COOKIE = $this->inputArray['cookie'];
|
||||
$_SERVER = $this->inputArray['server'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Do this later
|
||||
*/
|
||||
protected function sanitizeGlobals()
|
||||
{
|
||||
// Copy all values from the global arrays into a local inputArray
|
||||
|
@ -92,6 +136,102 @@ class Input
|
|||
// If required to, empty the global arrays
|
||||
if ($this->webConfig->get('empty_global_arrays'))
|
||||
unset($_GET, $_POST, $_COOKIE, $_SERVER);
|
||||
|
||||
// Clean GET
|
||||
foreach ($this->inputArray['get'] as $key => $val)
|
||||
$this->inputArray[$this->cleanInputKeys($key)] = $this->cleanInputData($val);
|
||||
|
||||
// Clean POST
|
||||
foreach ($this->inputArray['post'] as $key => $val)
|
||||
$this->inputArray[$this->cleanInputKeys($key)] = $this->cleanInputData($val);
|
||||
|
||||
// Clean COOKIE
|
||||
if (!empty($this->inputArray['cookie']))
|
||||
{
|
||||
// Get rid of conflicting cookies
|
||||
unset(
|
||||
$this->inputArray['cookie']['$Version'],
|
||||
$this->inputArray['cookie']['$Path'],
|
||||
$this->inputArray['cookie']['$Domain']
|
||||
);
|
||||
|
||||
foreach ($this->inputArray['cookie'] as $key => $val)
|
||||
{
|
||||
if (($cookie_key = $this->cleanInputKeys($key)) !== false)
|
||||
$this->inputArray['cookie'][$cookie_key] = $this->cleanInputData($val);
|
||||
else
|
||||
unset($this->inputArray['cookie'][$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Sanitize PHP_SELF
|
||||
$this->inputArray['server']['PHP_SELF'] = strip_tags($this->inputArray['server']['PHP_SELF']);
|
||||
Logger::logInfo("Global variables sanitized");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 cleanInputKeys(string $str, bool $fatal = true)
|
||||
{
|
||||
if (!preg_match('/^[a-z0-9:_\/|-]+$/i', $str))
|
||||
{
|
||||
if ($fatal)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
// @todo Implement status header 503
|
||||
exit(7);
|
||||
}
|
||||
}
|
||||
|
||||
// Clean with UTF8, if supported
|
||||
if (UTF8::$isEnabled)
|
||||
return UTF8::cleanString($str);
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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|array
|
||||
*/
|
||||
protected function cleanInputData($str)
|
||||
{
|
||||
if (is_array($str))
|
||||
{
|
||||
$new = [];
|
||||
foreach (array_keys($str) as $key)
|
||||
$new[$this->cleanInputKeys($key)] = $this->cleanInputData($str[$key]);
|
||||
|
||||
return $new;
|
||||
}
|
||||
|
||||
// Clean with UTF8 if supported
|
||||
if (UTF8::$isEnabled)
|
||||
$str = UTF8::cleanString($str);
|
||||
|
||||
// Remove invisible characters
|
||||
$str = UTF8::removeInvisibleCharacters($str, false);
|
||||
|
||||
// Standardize newlines (@todo)
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -123,9 +263,7 @@ class Input
|
|||
else
|
||||
return null;
|
||||
|
||||
// @todo Implement XSS Clean here
|
||||
|
||||
return $value;
|
||||
return ($xssClean === true ? $this->security->xss_clean($value) : $value);
|
||||
}
|
||||
|
||||
public function get($index = null, bool $xssClean = true)
|
||||
|
|
|
@ -37,9 +37,27 @@
|
|||
namespace FuzeWorks;
|
||||
|
||||
|
||||
use FuzeWorks\ConfigORM\ConfigORM;
|
||||
use FuzeWorks\Event\HelperLoadEvent;
|
||||
use FuzeWorks\Exception\OutputException;
|
||||
|
||||
class Output
|
||||
{
|
||||
|
||||
/**
|
||||
* The internal Input class
|
||||
*
|
||||
* @var Input
|
||||
*/
|
||||
private $input;
|
||||
|
||||
/**
|
||||
* WebCfg
|
||||
*
|
||||
* @var ConfigORM
|
||||
*/
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* Output to be sent to the client
|
||||
*
|
||||
|
@ -54,49 +72,251 @@ class Output
|
|||
*/
|
||||
protected $headers = [];
|
||||
|
||||
protected $compressOutput = false;
|
||||
|
||||
/**
|
||||
* List of mime types
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $mimes = [];
|
||||
protected $mimeType = 'text/html';
|
||||
|
||||
protected $statusCode = 200;
|
||||
protected $statusText = 'OK';
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->input = Factory::getInstance()->input;
|
||||
$this->mimes = Factory::getInstance()->config->getConfig('mimes')->toArray();
|
||||
$this->config = Factory::getInstance()->config->getConfig('web');
|
||||
|
||||
$zlib = (bool) ini_get('zlib.output_compression');
|
||||
$this->compressOutput = (!$zlib && $this->config->get('compress_output') && extension_loaded('zlib'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Output
|
||||
*
|
||||
* Returns the current output string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function getOutput(): string
|
||||
{
|
||||
return $this->output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Output
|
||||
*
|
||||
* Sets the output string.
|
||||
*
|
||||
* @param string $output Output data
|
||||
*/
|
||||
public function setOutput(string $output)
|
||||
{
|
||||
$this->output = $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Output
|
||||
*
|
||||
* Appends data onto the output string.
|
||||
*
|
||||
* @param string $output Data to append
|
||||
*/
|
||||
public function appendOutput(string $output)
|
||||
{
|
||||
$this->output .= $output;
|
||||
}
|
||||
|
||||
public function setHeader(string $header)
|
||||
/**
|
||||
* Display Output
|
||||
*
|
||||
* Processes and sends finalized output data to the browser along
|
||||
* with any server headers.
|
||||
*
|
||||
* @param string $output Output data override
|
||||
* @return void
|
||||
*/
|
||||
public function display(string $output = null)
|
||||
{
|
||||
$this->headers[] = $header;
|
||||
// Set the output data
|
||||
$output = is_null($output) ? $this->output : $output;
|
||||
|
||||
// First send status code
|
||||
http_response_code($this->statusCode);
|
||||
@header('Status: ' . $this->statusCode . ' ' . $this->statusText, true);
|
||||
|
||||
// If compression is requested, start buffering
|
||||
if (
|
||||
$this->compressOutput &&
|
||||
!is_null($this->input->server('HTTP_ACCEPT_ENCODING')) &&
|
||||
strpos($this->input->server('HTTP_ACCEPT_ENCODING'), 'gzip') !== false
|
||||
)
|
||||
{
|
||||
Logger::log("Compressing output...");
|
||||
ob_start('ob_gzhandler');
|
||||
}
|
||||
|
||||
// Send all available headers
|
||||
if (!empty($this->headers))
|
||||
foreach ($this->headers as $header)
|
||||
@header($header[0], $header[1]);
|
||||
|
||||
echo $output;
|
||||
|
||||
Logger::log('Output sent to browser');
|
||||
}
|
||||
|
||||
public function getHeader()
|
||||
/**
|
||||
* Set Header
|
||||
*
|
||||
* Lets you set a server header which will be sent with the final output.
|
||||
*
|
||||
* @param string $header Header
|
||||
* @param bool $replace Whether to replace the old header value, if already set
|
||||
*/
|
||||
public function setHeader(string $header, bool $replace = true)
|
||||
{
|
||||
|
||||
$this->headers[] = [$header, $replace];
|
||||
}
|
||||
|
||||
public function setContentType()
|
||||
/**
|
||||
* Get Header
|
||||
*
|
||||
* @param string $headerName
|
||||
* @return string|null
|
||||
*/
|
||||
public function getHeader(string $headerName)
|
||||
{
|
||||
// Combine sent headers with queued headers
|
||||
$headers = array_merge(
|
||||
array_map('array_shift', $this->headers),
|
||||
headers_list()
|
||||
);
|
||||
|
||||
if (empty($headers) || empty($headerName))
|
||||
return null;
|
||||
|
||||
foreach ($headers as $header)
|
||||
if (strncasecmp($headerName, $header, $l = strlen($headerName)) === 0)
|
||||
return trim(substr($header, $l+1));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getContentType()
|
||||
{
|
||||
/**
|
||||
* Set Content-Type Header
|
||||
*
|
||||
* @param string $mimeType Extension of the file we're outputting
|
||||
* @param string $charset Character set (default: NULL)
|
||||
*/
|
||||
|
||||
public function setContentType(string $mimeType, $charset = null)
|
||||
{
|
||||
if (strpos($mimeType, '/') === false)
|
||||
{
|
||||
$extension = ltrim($mimeType, '.');
|
||||
if (isset($this->mimes[$extension]))
|
||||
{
|
||||
$mimeType = &$this->mimes[$extension];
|
||||
if (is_array($mimeType))
|
||||
$mimeType = current($mimeType);
|
||||
}
|
||||
}
|
||||
|
||||
$this->mimeType = $mimeType;
|
||||
if (empty($charset))
|
||||
$charset = $this->config->get('charset');
|
||||
|
||||
$header = 'Content-Type: ' . $mimeType . (empty($charset) ? '' : '; charset='.$charset);
|
||||
$this->headers[] = [$header, true];
|
||||
}
|
||||
|
||||
public function setStatusHeader()
|
||||
/**
|
||||
* Get Current Content-Type Header
|
||||
*
|
||||
* @return string 'text/html', if not already set
|
||||
*/
|
||||
public function getContentType(): string
|
||||
{
|
||||
foreach ($this->headers as $header)
|
||||
if (sscanf($header[0], 'Content-Type: %[^;]', $contentType) === 1)
|
||||
return $contentType;
|
||||
|
||||
return 'text/html';
|
||||
}
|
||||
|
||||
public function cache()
|
||||
/**
|
||||
* Set HTTP Status Header
|
||||
*
|
||||
* @param int $code
|
||||
* @param string $text
|
||||
* @throws OutputException
|
||||
*/
|
||||
public function setStatusHeader(int $code = 200, string $text = '')
|
||||
{
|
||||
$this->statusCode = $code;
|
||||
if (!empty($text))
|
||||
$this->statusText = $text;
|
||||
else
|
||||
{
|
||||
$statusCodes = [
|
||||
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',
|
||||
|
||||
500 => 'Internal Server Error',
|
||||
501 => 'Not Implemented',
|
||||
502 => 'Bad Gateway',
|
||||
503 => 'Service Unavailable',
|
||||
504 => 'Gateway Timeout',
|
||||
505 => 'HTTP Version Not Supported'
|
||||
];
|
||||
|
||||
if (isset($statusCodes[$code]))
|
||||
$this->statusText = $statusCodes[$code];
|
||||
else
|
||||
throw new OutputException("Could not set status header. Code '" . $code . "' not recognized");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -36,8 +36,219 @@
|
|||
|
||||
namespace FuzeWorks;
|
||||
|
||||
use FuzeWorks\ConfigORM\ConfigORM;
|
||||
use FuzeWorks\Exception\UriException;
|
||||
|
||||
/**
|
||||
* Class URI
|
||||
*
|
||||
* @todo Add to assoc methods
|
||||
*/
|
||||
class URI
|
||||
{
|
||||
|
||||
/**
|
||||
* ConfigORM of the Web config file
|
||||
*
|
||||
* @var ConfigORM
|
||||
*/
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* @var Input
|
||||
*/
|
||||
private $input;
|
||||
|
||||
protected $baseUri;
|
||||
protected $uriString;
|
||||
protected $segments;
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->input = Factory::getInstance()->input;
|
||||
$this->config = Factory::getInstance()->config->getConfig('web');
|
||||
if (WebComponent::$willHandleRequest)
|
||||
{
|
||||
$this->determineUri();
|
||||
}
|
||||
}
|
||||
|
||||
public function determineUri()
|
||||
{
|
||||
// If no base_url is provided, attempt to determine URI with SERVER variables
|
||||
if (empty($this->config->get('base_url')))
|
||||
{
|
||||
$serverAddr = $this->input->server('SERVER_ADDR');
|
||||
if (!is_null($serverAddr))
|
||||
{
|
||||
if (strpos($serverAddr, ':') !== false)
|
||||
$serverAddr = '['.$serverAddr.']';
|
||||
|
||||
$scriptName = $this->input->server('SCRIPT_NAME');
|
||||
$scriptFilename = $this->input->server('SCRIPT_FILENAME');
|
||||
$baseUrl = ($this->isHttps() ? 'https' : 'http') .
|
||||
"://" . $serverAddr .
|
||||
substr($scriptName, 0, strpos($scriptName, basename($scriptFilename)));
|
||||
}
|
||||
else
|
||||
$baseUrl = 'http://localhost/';
|
||||
|
||||
$this->config->set('base_url', $baseUrl);
|
||||
}
|
||||
|
||||
// Set the baseUri
|
||||
$this->baseUri = $this->config->get('base_url');
|
||||
$subUri = $this->parseUri();
|
||||
|
||||
// Log the incoming request
|
||||
Logger::newLevel("Request received with the following URL: ");
|
||||
Logger::logInfo("Base URL: " . $this->baseUri);
|
||||
Logger::logInfo("Request URL: ". $subUri);
|
||||
Logger::stopLevel();
|
||||
|
||||
$this->setUri($this->parseUri());
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uriString(): string
|
||||
{
|
||||
return $this->uriString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch URI Segment
|
||||
*
|
||||
* @param int $n index
|
||||
* @return string|null
|
||||
*/
|
||||
public function segment(int $n)
|
||||
{
|
||||
return isset($this->segments[$n]) ? $this->segments[$n] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Segment Array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function segmentArray(): array
|
||||
{
|
||||
return $this->segments;
|
||||
}
|
||||
|
||||
protected function parseUri(): string
|
||||
{
|
||||
// If no vars are provided, return an empty string
|
||||
$vars = $this->input->server(['REQUEST_URI', 'SCRIPT_NAME', 'QUERY_STRING']);
|
||||
if (is_null($vars['REQUEST_URI']) || is_null($vars['SCRIPT_NAME']))
|
||||
return '';
|
||||
|
||||
// Get a basic URL from parse_url
|
||||
$uri = parse_url('http://dummy'.$vars['REQUEST_URI']);
|
||||
$uri = isset($uri['path']) ? $uri['path'] : '';
|
||||
|
||||
// Determine the script
|
||||
if (isset($vars['SCRIPT_NAME'][0]))
|
||||
{
|
||||
if (strpos($uri, $vars['SCRIPT_NAME']) === 0)
|
||||
$uri = (string) substr($uri, strlen($vars['SCRIPT_NAME']));
|
||||
elseif (strpos($uri, dirname($vars['SCRIPT_NAME'])) === 0)
|
||||
$uri = (string) substr($uri, strlen(dirname($vars['SCRIPT_NAME'])));
|
||||
|
||||
}
|
||||
|
||||
// If empty, return empty
|
||||
if ($uri === '/' || $uri === '')
|
||||
return '/';
|
||||
|
||||
// Remove the relative directory
|
||||
$uris = [];
|
||||
$tok = strtok($uri, '/');
|
||||
while ($tok !== false)
|
||||
{
|
||||
if ( (!empty($tok) || $tok === '0') && $tok !== '..')
|
||||
$uris[] = $tok;
|
||||
|
||||
$tok = strtok('/');
|
||||
}
|
||||
|
||||
return implode('/', $uris);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $str
|
||||
* @throws UriException
|
||||
*/
|
||||
protected function setUri($str)
|
||||
{
|
||||
// First clean the string
|
||||
$uri = $this->uriString = trim(UTF8::removeInvisibleCharacters($str, false), '/');
|
||||
if ($this->uriString === '')
|
||||
return;
|
||||
|
||||
// Determine the segments
|
||||
$this->segments[0] = null;
|
||||
foreach (explode('/', trim($uri, '/')) as $segment)
|
||||
{
|
||||
// Filter segments for security
|
||||
$segment = trim($segment);
|
||||
$this->filterUri($segment);
|
||||
|
||||
if ($segment !== '')
|
||||
$this->segments[] = $segment;
|
||||
}
|
||||
|
||||
unset($this->segments[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter URI
|
||||
*
|
||||
* Filters segments for malicious characters.
|
||||
*
|
||||
* @param string $str
|
||||
* @return bool
|
||||
* @throws UriException
|
||||
*/
|
||||
protected function filterUri(string &$str): bool
|
||||
{
|
||||
$permitted = $this->config->get('permitted_uri_chars');
|
||||
if (
|
||||
!empty($str) &&
|
||||
!empty($permitted) &&
|
||||
!preg_match('/^['.$permitted.']+$/i'.(UTF8::$isEnabled ? 'u' : ''), $str))
|
||||
{
|
||||
throw new UriException("The submitted URI has illegal characters.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is HTTPS?
|
||||
*
|
||||
* Determines if the application is accessed via an encrypted
|
||||
* (HTTPS) connection.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isHttps(): bool
|
||||
{
|
||||
$https = $this->input->server('HTTPS');
|
||||
if (!is_null($https) && strtolower($https) !== 'off')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
elseif (!is_null($this->input->server('HTTP_X_FORWARDED_PROTO')) && $this->input->server('HTTP_X_FORWARDED_PROTO') === 'https')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
elseif ( ! is_null($this->input->server('HTTP_FRONT_END_HTTPS')) && strtolower($this->input->server('HTTP_FRONT_END_HTTPS')) !== 'off')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,178 @@
|
|||
<?php
|
||||
/**
|
||||
* FuzeWorks WebComponent.
|
||||
*
|
||||
* The FuzeWorks PHP FrameWork
|
||||
*
|
||||
* Copyright (C) 2013-2019 TechFuze
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author TechFuze
|
||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
*
|
||||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 1.2.0
|
||||
*
|
||||
* @version Version 1.2.0
|
||||
*/
|
||||
|
||||
namespace FuzeWorks;
|
||||
|
||||
|
||||
class UTF8
|
||||
{
|
||||
|
||||
public static $isEnabled = true;
|
||||
|
||||
/**
|
||||
* Initializer for UTF-8
|
||||
*
|
||||
* Determines if UTF-8 support is to be enabled
|
||||
* @return void
|
||||
*/
|
||||
public static function init()
|
||||
{
|
||||
try {
|
||||
$charset = strtoupper(Factory::getInstance()->config->getConfig('web')->get('charset'));
|
||||
} catch (Exception\ConfigException $e) {
|
||||
$charset = 'UTF-8';
|
||||
}
|
||||
ini_set('default_charset', $charset);
|
||||
|
||||
// Enable mbstring if it is provided
|
||||
if (extension_loaded('mbstring'))
|
||||
{
|
||||
define('MBEnabled', true);
|
||||
mb_internal_encoding($charset);
|
||||
mb_substitute_character('none');
|
||||
}
|
||||
else
|
||||
define('MBEnabled', false);
|
||||
|
||||
// Enable iconv if it is provided
|
||||
if (extension_loaded('iconv'))
|
||||
{
|
||||
define('ICONVEnabled', true);
|
||||
ini_set('default_encoding', $charset);
|
||||
}
|
||||
else
|
||||
define('ICONVEnabled', false);
|
||||
|
||||
// Set some global values
|
||||
ini_set('php.internal_encoding', $charset);
|
||||
if (defined('PREG_BAD_UTF8_ERROR')
|
||||
&& (ICONVEnabled || MBEnabled)
|
||||
&& $charset === 'UTF-8')
|
||||
{
|
||||
self::$isEnabled = true;
|
||||
Logger::logInfo('UTF-8 support has been enabled');
|
||||
}
|
||||
else
|
||||
{
|
||||
self::$isEnabled = false;
|
||||
Logger::logInfo('UTF-8 support has not been enabled');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean UTF-8 strings
|
||||
*
|
||||
* Ensures strings contain only valid UTF-8 characters.
|
||||
*
|
||||
* @param string $str String to clean
|
||||
* @return string
|
||||
*/
|
||||
public static function cleanString(string $str): string
|
||||
{
|
||||
if (self::isAscii($str) === false)
|
||||
{
|
||||
if (MBEnabled)
|
||||
$str = mb_convert_encoding($str, 'UTF-8', 'UTF-8');
|
||||
elseif (ICONVEnabled)
|
||||
$str = @iconv('UTF-8', 'UTF-8//IGNORE', $str);
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert to UTF-8
|
||||
*
|
||||
* Attempts to convert a string to UTF-8.
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $encoding
|
||||
* @return bool|string
|
||||
*/
|
||||
public static function convertToUtf8(string $str, string $encoding)
|
||||
{
|
||||
if (MBEnabled)
|
||||
return mb_convert_encoding($str, 'UTF-8', $encoding);
|
||||
elseif (ICONVEnabled)
|
||||
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 static function isAscii(string $str): bool
|
||||
{
|
||||
return (preg_match('/[^\x00-\x7F]/S', $str) === 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Invisible Characters
|
||||
*
|
||||
* This prevents sandwiching null characters
|
||||
* between ascii characters, like Java\0script.
|
||||
*
|
||||
* @param string
|
||||
* @param bool
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public static function removeInvisibleCharacters($str, $urlEncoded = true): string
|
||||
{
|
||||
// First determine which characters are invisible
|
||||
if ($urlEncoded)
|
||||
$nonDisplayable = ['/%0[0-8bcef]/', '/%1[0-9a-f]/'];
|
||||
else
|
||||
$nonDisplayable = [];
|
||||
|
||||
$nonDisplayable[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S';
|
||||
|
||||
do
|
||||
{
|
||||
$str = preg_replace($nonDisplayable, '', $str, -1, $count);
|
||||
}
|
||||
while($count);
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
}
|
|
@ -36,10 +36,21 @@
|
|||
|
||||
namespace FuzeWorks;
|
||||
|
||||
use FuzeWorks\Exception\EventException;
|
||||
use FuzeWorks\Exception\Exception;
|
||||
use FuzeWorks\Exception\NotFoundException;
|
||||
use FuzeWorks\Exception\WebException;
|
||||
|
||||
class WebComponent implements iComponent
|
||||
{
|
||||
|
||||
/**
|
||||
* Whether WebComponent is configured to handle a web request
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public static $willHandleRequest = false;
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return "WebComponent";
|
||||
|
@ -49,8 +60,10 @@ class WebComponent implements iComponent
|
|||
{
|
||||
return [
|
||||
'web' => $this,
|
||||
'security' => '\FuzeWorks\Security',
|
||||
'input' => '\FuzeWorks\Input',
|
||||
'output' => '\FuzeWorks\Output'
|
||||
'output' => '\FuzeWorks\Output',
|
||||
'uri' => '\FuzeWorks\URI',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -63,18 +76,103 @@ class WebComponent implements iComponent
|
|||
// Add dependencies
|
||||
$configurator->addComponent(new MVCRComponent());
|
||||
|
||||
// Invoke methods to prepare system for HTTP calls
|
||||
$configurator->call('logger', 'setLoggerTemplate', null, 'logger_http');
|
||||
|
||||
// Add fallback config directory
|
||||
$configurator->addDirectory(
|
||||
dirname(__DIR__) . DIRECTORY_SEPARATOR . 'Config',
|
||||
'config',
|
||||
Priority::LOWEST
|
||||
);
|
||||
|
||||
// If WebComponent will handle a request, add some calls to the configurator
|
||||
if (self::$willHandleRequest)
|
||||
{
|
||||
// Invoke methods to prepare system for HTTP calls
|
||||
$configurator->call('logger', 'setLoggerTemplate', null, 'logger_http');
|
||||
}
|
||||
}
|
||||
|
||||
public function onCreateContainer(Factory $container)
|
||||
{
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
// First init UTF8
|
||||
UTF8::init();
|
||||
}
|
||||
|
||||
public function enableComponent()
|
||||
{
|
||||
self::$willHandleRequest = true;
|
||||
}
|
||||
|
||||
public function disableComponent()
|
||||
{
|
||||
self::$willHandleRequest = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws WebException
|
||||
*/
|
||||
public function routeWebRequest(): bool
|
||||
{
|
||||
if (!self::$willHandleRequest)
|
||||
throw new WebException("Could not route web request. WebComponent is not configured to handle requests");
|
||||
|
||||
// Set the output to display when shutting down
|
||||
try {
|
||||
Events::addListener(function () {
|
||||
/** @var Output $output */
|
||||
Logger::logInfo("Parsing output...");
|
||||
$output = Factory::getInstance()->output;
|
||||
$output->display();
|
||||
}, 'coreShutdownEvent', Priority::NORMAL);
|
||||
} catch (EventException $e) {
|
||||
throw new WebException("Could not route web request. coreShutdownEvent threw EventException: '".$e->getMessage()."'");
|
||||
}
|
||||
|
||||
/** @var Router $router */
|
||||
$router = Factory::getInstance()->router;
|
||||
|
||||
/** @var URI $uriObject */
|
||||
$uriObject = Factory::getInstance()->uri;
|
||||
$uri = $uriObject->uriString();
|
||||
|
||||
/** @var Output $output */
|
||||
$output = Factory::getInstance()->output;
|
||||
|
||||
// Attempt to load the requested page
|
||||
try {
|
||||
$viewOutput = $router->route($uri);
|
||||
} catch (NotFoundException $e) {
|
||||
Logger::logWarning("Requested page not found. Requesting Error/error404 View");
|
||||
$output->setStatusHeader(404);
|
||||
|
||||
// Request 404 page=
|
||||
try {
|
||||
$viewOutput = $router->route('Error/error404');
|
||||
} catch (NotFoundException $e) {
|
||||
// If still resulting in an error, do something else
|
||||
$viewOutput = 'ERROR 404. Page was not found.';
|
||||
} catch (Exception $e) {
|
||||
Logger::exceptionHandler($e, false);
|
||||
$viewOutput = 'ERROR 404. Page was not found.';
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
Logger::exceptionHandler($e, false);
|
||||
$output->setStatusHeader(500);
|
||||
try {
|
||||
$viewOutput = $router->route('Error/error500');
|
||||
} catch (Exception $error500Exception) {
|
||||
Logger::exceptionHandler($error500Exception, false);
|
||||
$viewOutput = 'ERROR 500. Page could not be loaded.';
|
||||
}
|
||||
}
|
||||
|
||||
// Append the output
|
||||
if (!empty($viewOutput))
|
||||
$output->appendOutput($viewOutput);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
/**
|
||||
* FuzeWorks WebComponent.
|
||||
*
|
||||
* The FuzeWorks PHP FrameWork
|
||||
*
|
||||
* Copyright (C) 2013-2019 TechFuze
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author TechFuze
|
||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
*
|
||||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 1.2.0
|
||||
*
|
||||
* @version Version 1.2.0
|
||||
*/
|
||||
|
||||
namespace FuzeWorks;
|
||||
|
||||
class WebController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Input
|
||||
*/
|
||||
protected $input;
|
||||
|
||||
/**
|
||||
* @var Output
|
||||
*/
|
||||
protected $output;
|
||||
|
||||
/**
|
||||
* @var URI
|
||||
*/
|
||||
protected $uri;
|
||||
|
||||
/**
|
||||
* WebView constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->input = Factory::getInstance()->input;
|
||||
$this->output = Factory::getInstance()->output;
|
||||
$this->uri = Factory::getInstance()->uri;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
/**
|
||||
* FuzeWorks WebComponent.
|
||||
*
|
||||
* The FuzeWorks PHP FrameWork
|
||||
*
|
||||
* Copyright (C) 2013-2019 TechFuze
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author TechFuze
|
||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
*
|
||||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 1.2.0
|
||||
*
|
||||
* @version Version 1.2.0
|
||||
*/
|
||||
|
||||
namespace FuzeWorks;
|
||||
|
||||
class WebModel extends Model
|
||||
{
|
||||
/**
|
||||
* @var Input
|
||||
*/
|
||||
protected $input;
|
||||
|
||||
/**
|
||||
* @var Output
|
||||
*/
|
||||
protected $output;
|
||||
|
||||
/**
|
||||
* @var URI
|
||||
*/
|
||||
protected $uri;
|
||||
|
||||
/**
|
||||
* WebView constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->input = Factory::getInstance()->input;
|
||||
$this->output = Factory::getInstance()->output;
|
||||
$this->uri = Factory::getInstance()->uri;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
/**
|
||||
* FuzeWorks WebComponent.
|
||||
*
|
||||
* The FuzeWorks PHP FrameWork
|
||||
*
|
||||
* Copyright (C) 2013-2019 TechFuze
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author TechFuze
|
||||
* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
*
|
||||
* @link http://techfuze.net/fuzeworks
|
||||
* @since Version 1.2.0
|
||||
*
|
||||
* @version Version 1.2.0
|
||||
*/
|
||||
|
||||
namespace FuzeWorks;
|
||||
|
||||
class WebView extends View
|
||||
{
|
||||
/**
|
||||
* @var Input
|
||||
*/
|
||||
protected $input;
|
||||
|
||||
/**
|
||||
* @var Output
|
||||
*/
|
||||
protected $output;
|
||||
|
||||
/**
|
||||
* @var URI
|
||||
*/
|
||||
protected $uri;
|
||||
|
||||
/**
|
||||
* WebView constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->input = Factory::getInstance()->input;
|
||||
$this->output = Factory::getInstance()->output;
|
||||
$this->uri = Factory::getInstance()->uri;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue