diff --git a/src/configs/ex/loadall.php b/src/configs/ex/loadall.php index e25ccfc..df946f2 100644 --- a/src/configs/ex/loadall.php +++ b/src/configs/ex/loadall.php @@ -2,74 +2,71 @@ /* * This file is Auto-Generated, Do NOT Modify!!! Please Delete this file to update configuration! */ - -/* Contents of : on_email.php */ - -\main_tts\configure::set('email', array( -// 'host' => '', // SMTP Hosts - seperated by ; -// 'username' => '', -// 'password' => '', - 'send_emails' => false, // Enable emails - 'email_on_errors' => false, - 'admin_emails' => array('Bob'=>'bob@localost', 'Chris'=>'chris@localost'), // Email Admins on error -)); -/* Contents of : on_html.php */ - -\main_tts\configure::set('html', array( - 'author' => 'Robert Strutts', - 'title' => 'In Example Project...', - 'javascript' => array('js/error_handler.js'=>'tts', 'js/store.js'=>'tts'), //'js/analytics.js'=>'project' - 'robots' => 'noindex', - 'keywords' => '', - 'description' => '', -)); -/* Contents of : on_http_request.php */ - -\main_tts\configure::set('http_request', array( - 'use' => 'sockets', // curl or sockets -)); - -/* Contents of : on_security.php */ - -\main_tts\configure::set('security', array( - 'show_dumps' => true, - 'key' => 'y8+HSfrO8wFknxND8SA2mQZBoYpPDeK+2FmIzdxFU9EmTsZ2rdo7GED0nt4DsKoHmbiBBIoNTMAfl+eEMv6qeA==', - 'main_salt' => 'e6fde23484881a29f7b6c6459456f3e1', - 'csrf_security_level' => 'high', // Stop Attacks at what cost?? - 'retries_allowed_before_throttling' => 3, // Reties attempts allowed for login, before it throttles it... - 'throttling_login_seconds' => 20, // Seconds to deny more login attempts - 'password_hash' => PASSWORD_BCRYPT, - 'password_hash_options' => ['cost' => 10], // Default=10. This is a good baseline cost, but you may want to consider increasing it depending on your hardware. -)); - -/* Contents of : on_sessions.php */ - -\main_tts\configure::set('sessions', array( - 'engine' => 'php', // php, db - 'type' => 'none', // Session Type: files, database, or cache - 'session_variable' => 'ses_app_aaa_', // set session variable name for project - 'session_name' => 'aaa_sys_342_', // More secure then PHPSESSID - 'session_table' => false, // DB PHP Session Table name, false = USE FILES - 'session_security_level' => 'blaze', // Faster Reqests keep at: blaze - 'session_key' => '6cb0d56f2345917624f2c5473e4d32cd', -)); -/* Contents of : on_tts.php */ - -\main_tts\configure::set_key('important', 'private_ip_as_local', false); - -\main_tts\configure::set('tts', array( - 'error_page' => 'tts', // or project - '404_page' => 'tts', // or project - 'ui_kit' => 'tts', // or project - 'site_name' => 'Testing', - 'short_url' => true, - 'default_project' => 'home', - 'check_HTML_tags' => true, - 'live' => false, //(! \tts\security::is_localhost() ) // Is this Production?? -)); - -/* Contents of : on_view_mode.php */ - -\main_tts\configure::set('view_mode', array( - 'default_paths' => array('json', 'common', 'flexbox', 'default') + +/* Contents of : on_email.php */ + +\main_tts\configure::set('email', array( +// 'host' => '', // SMTP Hosts - seperated by ; +// 'username' => '', +// 'password' => '', + 'send_emails' => false, // Enable emails + 'email_on_errors' => false, + 'admin_emails' => array('Bob'=>'bob@localost', 'Chris'=>'chris@localost'), // Email Admins on error +)); +/* Contents of : on_html.php */ + +\main_tts\configure::set('html', array( + 'author' => 'Robert Strutts', + 'title' => 'In Example Project...', + 'javascript' => array('js/error_handler.js'=>'tts', 'js/store.js'=>'tts'), //'js/analytics.js'=>'project' + 'robots' => 'noindex', + 'keywords' => '', + 'description' => '', +)); +/* Contents of : on_http_request.php */ + +\main_tts\configure::set('http_request', array( + 'use' => 'sockets', // curl or sockets +)); + +/* Contents of : on_security.php */ + +\main_tts\configure::set('security', array( + 'show_dumps' => true, + 'key' => 'y8+HSfrO8wFknxND8SA2mQZBoYpPDeK+2FmIzdxFU9EmTsZ2rdo7GED0nt4DsKoHmbiBBIoNTMAfl+eEMv6qeA==', + 'main_salt' => 'e6fde23484881a29f7b6c6459456f3e1', + 'csrf_security_level' => 'high', // Stop Attacks at what cost?? + 'retries_allowed_before_throttling' => 3, // Reties attempts allowed for login, before it throttles it... + 'throttling_login_seconds' => 20, // Seconds to deny more login attempts + 'password_hash' => PASSWORD_BCRYPT, + 'password_hash_options' => ['cost' => 10], // Default=10. This is a good baseline cost, but you may want to consider increasing it depending on your hardware. +)); + +/* Contents of : on_sessions.php */ + +\main_tts\configure::set('sessions', array( + 'engine' => 'php', // php, db + 'type' => 'none', // Session Type: files, database, or cache + 'session_variable' => 'ses_app_aaa_', // set session variable name for project + 'session_name' => 'aaa_sys_342_', // More secure then PHPSESSID + 'session_table' => false, // DB PHP Session Table name, false = USE FILES + 'session_security_level' => 'blaze', // Faster Reqests keep at: blaze + 'session_key' => '6cb0d56f2345917624f2c5473e4d32cd', +)); +/* Contents of : on_tts.php */ + +\main_tts\configure::set_key('important', 'private_ip_as_local', false); + +\main_tts\configure::set('tts', array( + 'site_name' => 'Testing', + 'short_url' => true, + 'default_project' => 'home', + 'check_HTML_tags' => true, + 'live' => false, //(! \tts\security::is_localhost() ) // Is this Production?? +)); + +/* Contents of : on_view_mode.php */ + +\main_tts\configure::set('view_mode', array( + 'default_paths' => array('json', 'common', 'flexbox', 'default') )); \ No newline at end of file diff --git a/src/configs/ex/on_tts.php b/src/configs/ex/on_tts.php index a762934..0158377 100644 --- a/src/configs/ex/on_tts.php +++ b/src/configs/ex/on_tts.php @@ -3,9 +3,6 @@ \main_tts\configure::set_key('important', 'private_ip_as_local', false); \main_tts\configure::set('tts', array( - 'error_page' => 'tts', // or project - '404_page' => 'tts', // or project - 'ui_kit' => 'tts', // or project 'site_name' => 'Testing', 'short_url' => true, 'default_project' => 'home', diff --git a/src/configs/live/on_tts.php b/src/configs/live/on_tts.php index fc611ef..29dd525 100644 --- a/src/configs/live/on_tts.php +++ b/src/configs/live/on_tts.php @@ -5,9 +5,6 @@ declare(strict_types=1); //\main_tts\configure::update('important', 'private_ip_as_local', true); \main_tts\configure::set('tts', array( - 'error_page' => 'tts', // or project - '404_page' => 'tts', // or project - 'ui_kit' => 'tts', // or project 'site_name' => 'My_Site_NAME_HERE', 'short_url' => true, 'default_project' => 'home', diff --git a/src/configs/mockup/loadall.php b/src/configs/mockup/loadall.php index 679d067..7bff50c 100644 --- a/src/configs/mockup/loadall.php +++ b/src/configs/mockup/loadall.php @@ -3,85 +3,85 @@ /* * This file is Auto-Generated, Do NOT Modify!!! Please Delete this file to update configuration! */ - -/* Contents of : on_email.php */ - -\main_tts\configure::set('email', array( -// 'host' => '', // SMTP Hosts - seperated by ; -// 'username' => '', -// 'password' => '', - 'send_emails' => false, // Enable emails - 'email_on_errors' => false, - 'admin_emails' => array('Bob'=>'bob@localost', 'Chris'=>'chris@localhost'), // Email Admins on error -)); -/* Contents of : on_html.php */ - -\main_tts\configure::set('html', array( - 'title' => 'In Mockup...', - 'author' => 'Robert Strutts', - 'javascript' => array('js/tts.min.js'=>'assets'), //'js/analytics.js'=>'project' - 'css' => array('css/style.css'=>'project'), - 'robots' => 'noindex', - 'keywords' => '', - 'description' => '', -)); -/* Contents of : on_http_request.php */ - -\main_tts\configure::set('http_request', array( - 'use' => 'sockets', // curl or sockets -)); - -/* Contents of : on_security.php */ - -\main_tts\configure::set('security', array( - 'show_dumps' => true, - 'key' => 'y8+HSfrO8wFknxND8SA2mQZBoYpPDeK+2FmIzdxFU9EmTsZ2rdo7GED0nt4DsKoHmbiBBIoNTMAfl+eEMv6qeA==', - 'main_salt' => 'e6fde23484881a29f7b6c6459456f3e1', - 'csrf_security_level' => 'high', // Stop Attacks at what cost?? - 'retries_allowed_before_throttling' => 3, // Reties attempts allowed for login, before it throttles it... - 'throttling_login_seconds' => 20, // Seconds to deny more login attempts - 'pepper_pwd' => 'SZFJXX]7HcwJjS]av3q8cUR', - 'salt_pwd' => 'fVN(P8nBNK3;tM88Kkku', -)); - -/* Contents of : on_sessions.php */ - -\main_tts\configure::set('sessions', array( - 'engine' => 'php', // php, db - 'type' => 'none', // Session Type: files, database, or cache - 'session_variable' => 'ses_app_aaa_', // set session variable name for project - 'session_name' => 'aaa_sys_342_', // More secure then PHPSESSID - 'session_table' => false, // DB PHP Session Table name, false = USE FILES - 'session_security_level' => 'blaze', // Faster Reqests keep at: blaze - 'session_key' => '6cb0d56f2345917624f2c5473e4d32cd', -)); -/* Contents of : on_tts.php */ - -/** - * @todo REMOVE or CHANGE [set_local_site_domains] to your - * PRIVATE or non-public accessible site domain name. - * - * Make sure the web-server only servers it on a - * loop-back or non-routable IP address range, - * otherwise people will be able to see lots of - * private DEBUG info. Also, make sure your HOST file has an - * entry to your web server's IP IG: 127.0.0.1 tts.home.local - * - * When in Doubt, just make live false, below here!!! - */ -\bs_tts\site_helper::set_local_site_domains('tts.home.local'); -// \bs_tts\site_helper::set_allowed_Private_IPs(['192.168.32.2', '192.168.32.3']); -// \bs_tts\site_helper::set_allowed_Public_IPs('12.x.x.x'); - -\main_tts\configure::set('tts', array( - 'site_name' => 'Testing', - 'short_url' => true, - 'default_project' => 'home', - 'check_HTML_tags' => true, - 'live' => (\bs_tts\site_helper::remote_not_allowed_force_live()), -)); -/* Contents of : on_view_mode.php */ - -\main_tts\configure::set('view_mode', array( - 'default_paths' => array('json', 'common', 'flexbox', 'default') + +/* Contents of : on_email.php */ + +\main_tts\configure::set('email', array( +// 'host' => '', // SMTP Hosts - seperated by ; +// 'username' => '', +// 'password' => '', + 'send_emails' => false, // Enable emails + 'email_on_errors' => false, + 'admin_emails' => array('Bob'=>'bob@localost', 'Chris'=>'chris@localhost'), // Email Admins on error +)); +/* Contents of : on_html.php */ + +\main_tts\configure::set('html', array( + 'title' => 'In Mockup...', + 'author' => 'Robert Strutts', + 'javascript' => array('js/tts.min.js'=>'assets'), //'js/analytics.js'=>'project' + 'css' => array('css/style.css'=>'project'), + 'robots' => 'noindex', + 'keywords' => '', + 'description' => '', +)); +/* Contents of : on_http_request.php */ + +\main_tts\configure::set('http_request', array( + 'use' => 'sockets', // curl or sockets +)); + +/* Contents of : on_security.php */ + +\main_tts\configure::set('security', array( + 'show_dumps' => true, + 'key' => 'y8+HSfrO8wFknxND8SA2mQZBoYpPDeK+2FmIzdxFU9EmTsZ2rdo7GED0nt4DsKoHmbiBBIoNTMAfl+eEMv6qeA==', + 'main_salt' => 'e6fde23484881a29f7b6c6459456f3e1', + 'csrf_security_level' => 'high', // Stop Attacks at what cost?? + 'retries_allowed_before_throttling' => 3, // Reties attempts allowed for login, before it throttles it... + 'throttling_login_seconds' => 20, // Seconds to deny more login attempts + 'pepper_pwd' => 'SZFJXX]7HcwJjS]av3q8cUR', + 'salt_pwd' => 'fVN(P8nBNK3;tM88Kkku', +)); + +/* Contents of : on_sessions.php */ + +\main_tts\configure::set('sessions', array( + 'engine' => 'php', // php, db + 'type' => 'none', // Session Type: files, database, or cache + 'session_variable' => 'ses_app_aaa_', // set session variable name for project + 'session_name' => 'aaa_sys_342_', // More secure then PHPSESSID + 'session_table' => false, // DB PHP Session Table name, false = USE FILES + 'session_security_level' => 'blaze', // Faster Reqests keep at: blaze + 'session_key' => '6cb0d56f2345917624f2c5473e4d32cd', +)); +/* Contents of : on_tts.php */ + +/** + * @todo REMOVE or CHANGE [set_local_site_domains] to your + * PRIVATE or non-public accessible site domain name. + * + * Make sure the web-server only servers it on a + * loop-back or non-routable IP address range, + * otherwise people will be able to see lots of + * private DEBUG info. Also, make sure your HOST file has an + * entry to your web server's IP IG: 127.0.0.1 tts.home.local + * + * When in Doubt, just make live false, below here!!! + */ +\bs_tts\site_helper::set_local_site_domains('tts.home.local'); +// \bs_tts\site_helper::set_allowed_Private_IPs(['192.168.32.2', '192.168.32.3']); +// \bs_tts\site_helper::set_allowed_Public_IPs('12.x.x.x'); + +\main_tts\configure::set('tts', array( + 'site_name' => 'Testing', + 'short_url' => true, + 'default_project' => 'home', + 'check_HTML_tags' => true, + 'live' => (\bs_tts\site_helper::remote_not_allowed_force_live()), +)); +/* Contents of : on_view_mode.php */ + +\main_tts\configure::set('view_mode', array( + 'default_paths' => array('json', 'common', 'flexbox', 'default') )); \ No newline at end of file diff --git a/src/ex/inputs/app/home_in.php b/src/ex/inputs/app/home_in.php index db39aa8..6980795 100644 --- a/src/ex/inputs/app/home_in.php +++ b/src/ex/inputs/app/home_in.php @@ -4,10 +4,11 @@ declare(strict_types=1); namespace prj\ex\inputs\app; -use \bs_tts\INPUTS; -use \bs_tts\FIELD_FILTER; -use \bs_tts\HTML_FLAG; -use \bs_tts\DB_FILTER; +use \tts\enum\INPUTS; +use \tts\enum\FIELD_FILTER; +use \tts\enum\HTML_FLAG; +use \tts\enum\DB_FILTER; + use \bs_tts\use_io as IO; class home_in { diff --git a/src/mockup/controllers/app/cookie_ctrl.php b/src/mockup/controllers/app/cookie_ctrl.php new file mode 100644 index 0000000..4bc7ad2 --- /dev/null +++ b/src/mockup/controllers/app/cookie_ctrl.php @@ -0,0 +1,39 @@ + + * @copyright Copyright (c) 2022, Robert Strutts. + * @license https://mit-license.org/ + */ +namespace prj\mockup\controllers\app; + +/** + * Description of cookie_ctrl + * + * @author Robert Strutts + */ +class cookie_ctrl { + + public function __construct() { + $key = "78a5011b9997cd03a28a3412c66565b7c32715b35e055d7abfc228236308d3b2"; + $sc = new \tts\services\paragon_crypto\sodium_storage($key); + + $handler = new \tts\services\sessions\cookie_sessions($sc); + session_set_save_handler($handler, true); + + session_start(); + } + + public function save() { + $_SESSION['admin'] = "Bob"; + $_SESSION['logged_in'] = true; + } + + public function read() { + var_dump($_SESSION); +// var_dump($_SESSION['admin'] ?? ""); + } + +} diff --git a/src/mockup/controllers/app/home_ctrl.php b/src/mockup/controllers/app/home_ctrl.php index 4843620..360dcaa 100644 --- a/src/mockup/controllers/app/home_ctrl.php +++ b/src/mockup/controllers/app/home_ctrl.php @@ -29,7 +29,7 @@ class home_ctrl { $view->render($this); } - public function name_demo_post() { + public function name_demo_post() { $view = new \tts\view(); $view->set('html', new \tts\html_document()); $view->set('output', IOL::auto_wire("app", "home", "name_demo")); diff --git a/src/mockup/views/on_error/404_page.php b/src/mockup/views/on_error/404_page.php new file mode 100644 index 0000000..e94dbda --- /dev/null +++ b/src/mockup/views/on_error/404_page.php @@ -0,0 +1,60 @@ + + * @copyright Copyright (c) 2022, Robert Strutts. + * @license https://mit-license.org/ + */ + + $protocol = "HTTP/1.0"; + if ( "HTTP/1.1" == $_SERVER["SERVER_PROTOCOL"] ) { + $protocol = "HTTP/1.1"; + } + + header( "{$protocol} 404 Not Found", true, 404 ); + header('Content-type: text/html; charset=utf-8'); + if (defined("PROJECT_ASSETS_BASE_REF")) { + $base_ref = PROJECT_ASSETS_BASE_REF; + } else { + $base_ref = ""; + } +?> + + + + + + + + + 404 Page not found! + + + +
+ + Page not found. +

404 Page not found!

+

Our apologies for the temporary inconvenience.

+
+ + + + + + + + + + + + + + + + DEV ERROR! + + + +
+
+ page_output; ?> +
+ + \ No newline at end of file diff --git a/src/mockup/views/on_error/prod_error.php b/src/mockup/views/on_error/prod_error.php new file mode 100644 index 0000000..41731d1 --- /dev/null +++ b/src/mockup/views/on_error/prod_error.php @@ -0,0 +1,48 @@ + + * @copyright Copyright (c) 2022, Robert Strutts. + * @license https://mit-license.org/ + */ + +define('PRODUCTION', 600); +define('MAINTENACE', 3600); // 1 hour = 3600 seconds +define('RETRY_AFTER', PRODUCTION); + +if(! headers_sent()) { + header('HTTP/1.1 503 Service Temporarily Unavailable'); + header('Status: 503 Service Temporarily Unavailable'); + header('Retry-After: ' . RETRY_AFTER); +} +if (defined("PROJECT_ASSETS_BASE_REF")) { + $base_ref = PROJECT_ASSETS_BASE_REF; +} else { + $base_ref = ""; +} +?> + + + + + + + + + + + Sorry, we had an error... + + + + +

Sorry, we had an error...

+

We apologize for any inconvenience this may cause.

+ + + +