Refactored code to use tts.php file

main
Robert 3 years ago
parent 6cbb070429
commit 9b4c12913f
  1. 8
      cli_cron
  2. 8
      public/main.page
  3. 3
      src/before_main.php
  4. 72
      src/configs/ex/loadall.php
  5. 2
      src/configs/ex/on_email.php
  6. 2
      src/configs/ex/on_html.php
  7. 2
      src/configs/ex/on_http_request.php
  8. 2
      src/configs/ex/on_security.php
  9. 2
      src/configs/ex/on_sessions.php
  10. 22
      src/configs/ex/on_tts.php
  11. 2
      src/configs/ex/on_view_mode.php
  12. 160
      src/configs/mockup/loadall.php
  13. 2
      src/configs/mockup/on_email.php
  14. 2
      src/configs/mockup/on_html.php
  15. 2
      src/configs/mockup/on_http_request.php
  16. 2
      src/configs/mockup/on_security.php
  17. 2
      src/configs/mockup/on_sessions.php
  18. 6
      src/configs/mockup/on_tts.php
  19. 2
      src/configs/mockup/on_view_mode.php
  20. 2
      src/ex/controllers/app/home_ctrl.php
  21. 12
      src/ex/inputs/app/home_in.php
  22. 4
      src/ex/logic/app/home_logic.php
  23. 18
      src/ex/models/app/home_model.php
  24. 6
      src/ex/outputs/app/home_out.php
  25. 4
      src/ex/outputs/bills/notices_out.php
  26. 5
      src/main.php
  27. 3
      src/mockup/cli_controllers/app/home_ctrl.php
  28. 8
      src/mockup/controllers/app/enc_ctrl.php
  29. 2
      src/mockup/controllers/app/home_ctrl.php
  30. 12
      src/mockup/inputs/app/home_in.php
  31. 4
      src/mockup/logic/app/home_logic.php
  32. 20
      src/mockup/models/app/home_model.php
  33. 6
      src/mockup/outputs/app/home_out.php
  34. 4
      src/mockup/outputs/bills/notices_out.php
  35. 54
      src/services/ex/loadall.php
  36. 4
      src/services/ex/on_html_filter.php
  37. 8
      src/services/ex/on_log.php
  38. 4
      src/services/ex/on_templates.php
  39. 2
      src/services/ex/on_test_db.php
  40. 33
      src/services/mockup/loadall.php
  41. 4
      src/services/mockup/on_html_filter.php
  42. 8
      src/services/mockup/on_log.php
  43. 13
      src/services/mockup/on_session_encryption.php
  44. 4
      src/services/mockup/on_templates.php
  45. 2
      src/services/mockup/on_test_db.php

@ -10,13 +10,13 @@ declare(strict_types=1);
*/
require 'src/before_main.php';
\bs_tts\site_helper::set_all_projects(['mockup','ex','live']);
\bs_tts\site_helper::set_default_project("mockup");
\tts\site_helper::set_all_projects(['mockup','ex','live']);
\tts\site_helper::set_default_project("mockup");
$PHPUNIT_Testing = false;
$cli_args = \bs_tts\site_helper::get_cli_args();
\bs_tts\site_helper::init(PROJECT_BASE_DIR, $cli_args, "get", $PHPUNIT_Testing);
$cli_args = \tts\site_helper::get_cli_args();
\tts\site_helper::init(PROJECT_BASE_DIR, $cli_args, "get", $PHPUNIT_Testing);
require 'src/main.php';

@ -8,7 +8,7 @@ declare(strict_types=1);
* @license https://mit-license.org/
*/
$show_all_startup_errors = false; // Always, Keep false on LIVE PROD SYS!!
$show_all_startup_errors = true; // Always, Keep false on LIVE PROD SYS!!
if ($show_all_startup_errors) {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
@ -16,11 +16,11 @@ if ($show_all_startup_errors) {
}
require '../src/before_main.php';
\bs_tts\site_helper::set_all_projects(['mockup','ex','live']);
\bs_tts\site_helper::set_default_project("mockup");
\tts\site_helper::set_all_projects(['mockup','ex','live']);
\tts\site_helper::set_default_project("mockup");
$PHPUNIT_Testing = false;
\bs_tts\site_helper::init(PROJECT_BASE_DIR, $_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD'], $PHPUNIT_Testing);
\tts\site_helper::init(PROJECT_BASE_DIR, $_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD'], $PHPUNIT_Testing);
require '../src/main.php';

@ -4,4 +4,5 @@ declare(strict_types=1);
const PROJECT_BASE_DIR = __DIR__ . '/';
require '/var/www/frames/tts_framework/src/bootstrap/site_helper.php';
require '/var/www/frames/tts_framework/src/dist/tts.php';
//require '/var/www/frames/tts_framework/src/bootstrap/site_helper.php';

@ -1,72 +0,0 @@
<?php
/*
* 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(
'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')
));

@ -1,6 +1,6 @@
<?php
\main_tts\configure::set('email', array(
\tts\configure::set('email', array(
// 'host' => '', // SMTP Hosts - seperated by ;
// 'username' => '',
// 'password' => '',

@ -1,6 +1,6 @@
<?php
\main_tts\configure::set('html', array(
\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'

@ -1,5 +1,5 @@
<?php
\main_tts\configure::set('http_request', array(
\tts\configure::set('http_request', array(
'use' => 'sockets', // curl or sockets
));

@ -1,6 +1,6 @@
<?php
\main_tts\configure::set('security', array(
\tts\configure::set('security', array(
'show_dumps' => true,
'key' => 'y8+HSfrO8wFknxND8SA2mQZBoYpPDeK+2FmIzdxFU9EmTsZ2rdo7GED0nt4DsKoHmbiBBIoNTMAfl+eEMv6qeA==',
'main_salt' => 'e6fde23484881a29f7b6c6459456f3e1',

@ -1,6 +1,6 @@
<?php
\main_tts\configure::set('sessions', array(
\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

@ -1,11 +1,25 @@
<?php
\main_tts\configure::set_key('important', 'private_ip_as_local', false);
/**
* @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!!!
*/
\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(
\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??
));
'live' => (\tts\site_helper::remote_not_allowed_force_live()),
));

@ -1,5 +1,5 @@
<?php
\main_tts\configure::set('view_mode', array(
\tts\configure::set('view_mode', array(
'default_paths' => array('json', 'common', 'flexbox', 'default')
));

@ -3,84 +3,84 @@
/*
* 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(
'type' => 'cookies', // Session Type: php, files, redis, or cookies
'session_variable' => 'ses_app_', // set session variable name for project
'session_name' => 'main_SESS', // 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' => '78a5011b9997cd03a28a3412c66565b7c32715b35e055d7abfc228236308d3b2',
));
/* 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 */
\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 */
\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 */
\tts\configure::set('http_request', array(
'use' => 'sockets', // curl or sockets
));
/* Contents of : on_security.php */
\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 */
\tts\configure::set('sessions', array(
'type' => 'cookies', // Session Type: php, files, redis, or cookies
'session_variable' => 'ses_app_', // set session variable name for project
'session_name' => 'main_SESS', // 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' => '78a5011b9997cd03a28a3412c66565b7c32715b35e055d7abfc228236308d3b2',
));
/* 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!!!
*/
\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');
\tts\configure::set('tts', array(
'site_name' => 'Testing',
'short_url' => true,
'default_project' => 'home',
'check_HTML_tags' => true,
'live' => (\tts\site_helper::remote_not_allowed_force_live()),
));
/* Contents of : on_view_mode.php */
\tts\configure::set('view_mode', array(
'default_paths' => array('json', 'common', 'flexbox', 'default')
));

@ -1,6 +1,6 @@
<?php
\main_tts\configure::set('email', array(
\tts\configure::set('email', array(
// 'host' => '', // SMTP Hosts - seperated by ;
// 'username' => '',
// 'password' => '',

@ -1,6 +1,6 @@
<?php
\main_tts\configure::set('html', array(
\tts\configure::set('html', array(
'title' => 'In Mockup...',
'author' => 'Robert Strutts',
'javascript' => array('js/tts.min.js'=>'assets'), //'js/analytics.js'=>'project'

@ -1,5 +1,5 @@
<?php
\main_tts\configure::set('http_request', array(
\tts\configure::set('http_request', array(
'use' => 'sockets', // curl or sockets
));

@ -1,6 +1,6 @@
<?php
\main_tts\configure::set('security', array(
\tts\configure::set('security', array(
'show_dumps' => true,
'key' => 'y8+HSfrO8wFknxND8SA2mQZBoYpPDeK+2FmIzdxFU9EmTsZ2rdo7GED0nt4DsKoHmbiBBIoNTMAfl+eEMv6qeA==',
'main_salt' => 'e6fde23484881a29f7b6c6459456f3e1',

@ -1,6 +1,6 @@
<?php
\main_tts\configure::set('sessions', array(
\tts\configure::set('sessions', array(
'type' => 'cookies', // Session Type: php, files, redis, or cookies
'session_variable' => 'ses_app_', // set session variable name for project
'session_name' => 'main_SESS', // More secure then PHPSESSID

@ -12,14 +12,14 @@
*
* When in Doubt, just make live false, below here!!!
*/
\bs_tts\site_helper::set_local_site_domains('tts.home.local');
\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(
\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()),
'live' => (\tts\site_helper::remote_not_allowed_force_live()),
));

@ -1,5 +1,5 @@
<?php
\main_tts\configure::set('view_mode', array(
\tts\configure::set('view_mode', array(
'default_paths' => array('json', 'common', 'flexbox', 'default')
));

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace prj\ex\controllers\app;
use \bs_tts\use_iol as IOL;
use \tts\use_iol as IOL;
class home_ctrl {
public $page_output;

@ -4,12 +4,12 @@ declare(strict_types=1);
namespace prj\ex\inputs\app;
use \tts\enum\INPUTS;
use \tts\enum\FIELD_FILTER;
use \tts\enum\HTML_FLAG;
use \tts\enum\DB_FILTER;
use \tts\INPUTS;
use \tts\FIELD_FILTER;
use \tts\HTML_FLAG;
use \tts\DB_FILTER;
use \bs_tts\use_io as IO;
use \tts\use_io as IO;
class home_in {
@ -22,7 +22,7 @@ class home_in {
*/
public static function name_demo(): array {
\bs_tts\safer_io::init_json(); // Staticly set JSON data if any
\tts\safer_io::init_json(); // Staticly set JSON data if any
$required_post_string_field = new IO();
$required_post_string_field->input_type = INPUTS::post;

@ -4,12 +4,12 @@ declare(strict_types=1);
namespace prj\ex\logic\app;
use \bs_tts\safer_io as SafeIO;
use \tts\safer_io as SafeIO;
class home_logic {
public static function name_demo(array & $input): void {
$model = new \prj\ex\models\app\home_model(\main_tts\registry::get('db'));
$model = new \prj\ex\models\app\home_model(\tts\registry::get('db'));
$submitted = true;
foreach(SafeIO::logic_sanitize($input) as $data) {

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace prj\ex\models\app;
class home_model extends \tts\database\model {
class home_model extends \tts\model {
protected $pdo;
protected $table = "test_names";
@ -36,19 +36,19 @@ class home_model extends \tts\database\model {
try {
$this->pdo->query($create_table_sql);
} catch (\PDOException $e) {
echo \tts\exceptions\DB_Exception::customMessage($e, "Unable to make table!");
echo \tts\DB_Exception::customMessage($e, "Unable to make table!");
}
}
public function populate($rows): void {
$dummy = new \tts\database\dummy_data($this->pdo);
$data = [ 'first_name' => \tts\arrays\mocking\rnd_names::get_first_names(),
'last_name' => \tts\arrays\mocking\rnd_names::get_last_names(),
'age' => \tts\arrays\mocking\rnd_names::mock_age() ];
$dummy = new \tts\dummy_data($this->pdo);
$data = [ 'first_name' => \tts\rnd_names::get_first_names(),
'last_name' => \tts\rnd_names::get_last_names(),
'age' => \tts\rnd_names::mock_age() ];
try {
$dummy->add_dummy_data($this->table, $rows, $data);
} catch (\PDOException $e) {
echo \tts\exceptions\DB_Exception::customMessage($e, "Unable to populate table!");
echo \tts\DB_Exception::customMessage($e, "Unable to populate table!");
}
}
@ -60,7 +60,7 @@ class home_model extends \tts\database\model {
try {
$status = $this->save();
} catch (\PDOException $e) {
echo \tts\exceptions\DB_Exception::customMessage($e, "Unable to save changes!");
echo \tts\DB_Exception::customMessage($e, "Unable to save changes!");
}
if ($status === self::successful_save) {
return true; // It saved
@ -77,7 +77,7 @@ class home_model extends \tts\database\model {
$result = $this->pdo->query($sql);
return self::pdo_fetch_lazy($result);
} catch (\PDOException $e) {
echo \tts\exceptions\DB_Exception::customMessage($e);
echo \tts\DB_Exception::customMessage($e);
}
}
}

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace prj\ex\outputs\app;
use \bs_tts\safer_io as SafeIO;
use \tts\safer_io as SafeIO;
class home_out {
@ -21,7 +21,7 @@ class home_out {
$key = $html['name'] ?? "";
$html_output[$key] = $html['html'];
if (\bs_tts\common::get_count($html['errors'])) {
if (\tts\common::get_count($html['errors'])) {
$errors[$key] = $html['errors'][$key];
}
}
@ -30,7 +30,7 @@ class home_out {
$first_name = $html_output['first_name'] ?? "Unknown";
$last_name = $html_output['last_name'] ?? "Unknown";
$ret['main'] = (\bs_tts\common::get_count($errors)) ? "" : "Hello, {$first_name} {$last_name}, you are {$age} years old!" . PHP_EOL;
$ret['main'] = (\tts\common::get_count($errors)) ? "" : "Hello, {$first_name} {$last_name}, you are {$age} years old!" . PHP_EOL;
$ret['errors'] = $errors;
} else {
$ret['main'] = "Welcome";

@ -24,10 +24,10 @@ class notices_out {
}
public static function gen_pdf_for_late_payment(string $html_code): void {
$style_sheet = file_get_contents(\bs_tts\site_helper::get_root() . \bs_tts\site_helper::get_project() . 'views/default/bills/notice_of_late_payment_css.php');
$style_sheet = file_get_contents(\tts\site_helper::get_root() . \tts\site_helper::get_project() . 'views/default/bills/notice_of_late_payment_css.php');
require_once TTS_VENDOR . 'autoload.php';
$mpdf = new \Mpdf\Mpdf(['tempDir' => \bs_tts\site_helper::get_root() . '/tmp/mpdf']); // chown www-data, chmod 775
$mpdf = new \Mpdf\Mpdf(['tempDir' => \tts\site_helper::get_root() . '/tmp/mpdf']); // chown www-data, chmod 775
$mpdf->AddFontDirectory(PROJECT_ASSETS_DIR . '/fonts');
$mpdf->fontdata['jennasue'] = ['R'=>"JennaSue.ttf"];

@ -1,5 +1,7 @@
<?php
\tts\set_ns();
/*
declare(strict_types=1);
require '/var/www/frames/tts_framework/src/main.inc.php';
@ -7,4 +9,5 @@ require '/var/www/frames/tts_framework/src/main.inc.php';
$purifier = '/var/www/frames/tts_framework/src/bootstrap/html_purifier.php';
if (file_exists($purifier)) {
include $purifier;
}
}
*/

@ -54,8 +54,7 @@ class home_ctrl {
$all_files[] = $dir . "tag_matches.php";
$all_files[] = $dir . "validator.php";
$all_files[] = $dir . "view.php";
$all_files[] = $dir . "database/help_load.php";
$all_files[] = $dir . "database/help_save.php";
$all_files[] = $dir . "database/model.php";
$all_files[] = $dir . "database/paginate.php";
$all_files[] = $dir . "traits/database/run_sql.php";
$all_files[] = $dir . "traits/database/validation.php";

@ -30,7 +30,7 @@ class enc_ctrl {
}
private function time_enc(array $levels): void {
$enc = new \tts\services\encryption($this->key);
$enc = new \tts\encryption($this->key);
foreach($levels as $level) {
echo "ENC: Level = $level <br>" . PHP_EOL;
$enc->change_security_level($level);
@ -70,7 +70,7 @@ class enc_ctrl {
public function sodium() { // 0.0041 Seconds
$key = "oH5LUubQXkUgC2sXkxahLnzgcZokVFANyxAew+kOvuk=";
$crypto = new \tts\services\paragon_crypto\crypto($key);
$crypto = new \tts\crypto($key);
// echo $crypto->a_single_key_maker();
@ -91,7 +91,7 @@ class enc_ctrl {
public function storage() {
$key = "78a5011b9997cd03a28a3412c66565b7c32715b35e055d7abfc228236308d3b2";
$sc = new \tts\services\paragon_crypto\sodium_storage($key);
$sc = new \tts\sodium_storage($key);
$startTime = microtime(true);
$encoded = $sc->encrypt($this->get_roles());
@ -113,7 +113,7 @@ class enc_ctrl {
public function sodium_pwd_test() { // 0.1233 Seconds
$startTime = microtime(true);
$c = new \tts\services\paragon_crypto\password_storage();
$c = new \tts\password_storage();
// $key = $c->generate_a_key();
$key = "9054695cc0f4080c15865de470f63ee993478b14c357eb910c815a4e0a1d4401";

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace prj\mockup\controllers\app;
use \bs_tts\use_iol as IOL;
use \tts\use_iol as IOL;
class home_ctrl {
public $page_output;

@ -4,12 +4,12 @@ declare(strict_types=1);
namespace prj\mockup\inputs\app;
use \tts\enum\INPUTS;
use \tts\enum\FIELD_FILTER;
use \tts\enum\HTML_FLAG;
use \tts\enum\DB_FILTER;
use \tts\INPUTS;
use \tts\FIELD_FILTER;
use \tts\HTML_FLAG;
use \tts\DB_FILTER;
use \bs_tts\use_io as IO;
use \tts\use_io as IO;
class home_in {
@ -22,7 +22,7 @@ class home_in {
*/
public static function name_demo(): array {
\bs_tts\safer_io::init_json(); // Staticly set JSON data if any
\tts\safer_io::init_json(); // Staticly set JSON data if any
$required_post_string_field = new IO();
$required_post_string_field->input_type = INPUTS::post;

@ -4,12 +4,12 @@ declare(strict_types=1);
namespace prj\mockup\logic\app;
use \bs_tts\safer_io as SafeIO;
use \tts\safer_io as SafeIO;
class home_logic {
public static function name_demo(array & $input): void {
$model = new \prj\mockup\models\app\home_model(\main_tts\registry::get('db'));
$model = new \prj\mockup\models\app\home_model(\tts\registry::get('db'));
$submitted = true;
foreach(SafeIO::logic_sanitize($input) as $data) {

@ -4,12 +4,12 @@ declare(strict_types=1);
namespace prj\mockup\models\app;
class home_model extends \tts\database\model {
class home_model extends \tts\model {
protected $pdo;
protected $table = "test_names";
public function __construct($dbh) {
// \tts\exceptions\DB_Exception::$error_message = "Home Model Error";
// \tts\DB_Exception::$error_message = "Home Model Error";
$this->pdo = $dbh;
}
@ -36,19 +36,19 @@ class home_model extends \tts\database\model {
try {
$this->pdo->query($create_table_sql);
} catch (\PDOException $e) {
echo \tts\exceptions\DB_Exception::customMessage($e, "Unable to make table!");
echo \tts\DB_Exception::customMessage($e, "Unable to make table!");
}
}
public function populate($rows): void {
$dummy = new \tts\database\dummy_data($this->pdo);
$data = [ 'first_name' => \tts\arrays\mocking\rnd_names::get_first_names(),
'last_name' => \tts\arrays\mocking\rnd_names::get_last_names(),
'age' => \tts\arrays\mocking\rnd_names::mock_age() ];
$dummy = new \tts\dummy_data($this->pdo);
$data = [ 'first_name' => \tts\rnd_names::get_first_names(),
'last_name' => \tts\rnd_names::get_last_names(),
'age' => \tts\rnd_names::mock_age() ];
try {
$dummy->add_dummy_data($this->table, $rows, $data);
} catch (\PDOException $e) {
echo \tts\exceptions\DB_Exception::customMessage($e, "Unable to populate table!");
echo \tts\DB_Exception::customMessage($e, "Unable to populate table!");
}
}
@ -60,7 +60,7 @@ class home_model extends \tts\database\model {
try {
$status = $this->save();
} catch (\PDOException $e) {
echo \tts\exceptions\DB_Exception::customMessage($e, "Unable to save changes!");
echo \tts\DB_Exception::customMessage($e, "Unable to save changes!");
}
if ($status === self::successful_save) {
return true; // It saved
@ -77,7 +77,7 @@ class home_model extends \tts\database\model {
$result = $this->pdo->query($sql);
return self::pdo_fetch_lazy($result);
} catch (\PDOException $e) {
echo \tts\exceptions\DB_Exception::customMessage($e);
echo \tts\DB_Exception::customMessage($e);
}
}
}

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace prj\mockup\outputs\app;
use \bs_tts\safer_io as SafeIO;
use \tts\safer_io as SafeIO;
class home_out {
@ -21,7 +21,7 @@ class home_out {
$key = $html['name'] ?? "";
$html_output[$key] = $html['html'];
if (\bs_tts\common::get_count($html['errors'])) {
if (\tts\common::get_count($html['errors'])) {
$errors[$key] = $html['errors'][$key];
}
}
@ -30,7 +30,7 @@ class home_out {
$first_name = $html_output['first_name'] ?? "Unknown";
$last_name = $html_output['last_name'] ?? "Unknown";
$ret['main'] = (\bs_tts\common::get_count($errors)) ? "" : "Hello, {$first_name} {$last_name}, you are {$age} years old!" . PHP_EOL;
$ret['main'] = (\tts\common::get_count($errors)) ? "" : "Hello, {$first_name} {$last_name}, you are {$age} years old!" . PHP_EOL;
$ret['errors'] = $errors;
} else {
$ret['main'] = "Welcome";

@ -24,10 +24,10 @@ class notices_out {
}
public static function gen_pdf_for_late_payment(string $html_code): void {
$style_sheet = file_get_contents(\bs_tts\site_helper::get_root() . \bs_tts\site_helper::get_project() . 'views/default/bills/notice_of_late_payment_css.php');
$style_sheet = file_get_contents(\tts\site_helper::get_root() . \tts\site_helper::get_project() . 'views/default/bills/notice_of_late_payment_css.php');
require_once TTS_VENDOR . 'autoload.php';
$mpdf = new \Mpdf\Mpdf(['tempDir' => \bs_tts\site_helper::get_root() . '/tmp/mpdf']); // chown www-data, chmod 775
$mpdf = new \Mpdf\Mpdf(['tempDir' => \tts\site_helper::get_root() . '/tmp/mpdf']); // chown www-data, chmod 775
$mpdf->AddFontDirectory(PROJECT_ASSETS_DIR . '/fonts');
$mpdf->fontdata['jennasue'] = ['R'=>"JennaSue.ttf"];

@ -1,54 +0,0 @@
<?php
declare(strict_types=1);
/*
* This file is Auto-Generated, Do NOT Modify!!! Please Delete this file to update configuration!
*/
/* Contents of : on_html_filter.php */
\main_tts\registry::get('di')->register('html_filter', function() {
return new \tts\services\html_filter();
});
/* Contents of : on_log.php */
\main_tts\registry::get('di')->register('log', function(array $arg) {
$file_name = null;
if (isset($arg[0]) && is_string($arg[0])) {
$file_name = $arg[0]; // filename
}
if (isset($arg[1]) && is_int($arg[1])) {
$count = $arg[1]; // max count
return new \tts\services\log($file_name, $count);
}
if (! empty($file_name)) {
return new \tts\services\log($file_name);
}
return new \tts\services\log();
});
/* Contents of : on_templates.php */
\main_tts\registry::get('di')->register('templates', function(array $arg) {
$file_type = '.tpl';
if (isset($arg[0]) && is_string($arg[0])) {
$file_type = $arg[0];
}
return new \tts\services\liquid_templates($file_type);
});
/* Contents of : on_test_db.php */
\main_tts\registry::get('di')->register('db_mocker', function($args) {
try {
$conn = new \PDO('sqlite::memory:');
// set the PDO error mode to exception
$conn->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
return $conn;
} catch (\PDOException $e) {
echo $e->getMessage();
} catch (\Exception $e) {
echo $e->getMessage();
}
});

@ -2,6 +2,6 @@
declare(strict_types=1);
\main_tts\registry::get('di')->register('html_filter', function() {
return new \tts\services\html_filter();
\tts\registry::get('di')->register('html_filter', function() {
return new \tts\html_filter();
});

@ -2,7 +2,7 @@
declare(strict_types=1);
\main_tts\registry::get('di')->register('log', function(array $arg) {
\tts\registry::get('di')->register('log', function(array $arg) {
$file_name = null;
if (isset($arg[0]) && is_string($arg[0])) {
$file_name = $arg[0]; // filename
@ -10,12 +10,12 @@ declare(strict_types=1);
if (isset($arg[1]) && is_int($arg[1])) {
$count = $arg[1]; // max count
return new \tts\services\log($file_name, $count);
return new \tts\log($file_name, $count);
}
if (! empty($file_name)) {
return new \tts\services\log($file_name);
return new \tts\log($file_name);
}
return new \tts\services\log();
return new \tts\log();
});

@ -2,10 +2,10 @@
declare(strict_types=1);
\main_tts\registry::get('di')->register('templates', function(array $arg) {
\tts\registry::get('di')->register('templates', function(array $arg) {
$file_type = '.tpl';
if (isset($arg[0]) && is_string($arg[0])) {
$file_type = $arg[0];
}
return new \tts\services\liquid_templates($file_type);
return new \tts\liquid_templates($file_type);
});

@ -2,7 +2,7 @@
declare(strict_types=1);
\main_tts\registry::get('di')->register('db_mocker', function($args) {
\tts\registry::get('di')->register('db_mocker', function($args) {
try {
$conn = new \PDO('sqlite::memory:');
// set the PDO error mode to exception

@ -6,14 +6,12 @@
/* Contents of : on_html_filter.php */
\main_tts\registry::get('di')->register('html_filter', function() {
return new \tts\services\html_filter();
\tts\registry::get('di')->register('html_filter', function() {
return new \tts\html_filter();
});
/* Contents of : on_log.php */
\main_tts\registry::get('di')->register('log', function(array $arg) {
\tts\registry::get('di')->register('log', function(array $arg) {
$file_name = null;
if (isset($arg[0]) && is_string($arg[0])) {
$file_name = $arg[0]; // filename
@ -21,43 +19,38 @@
if (isset($arg[1]) && is_int($arg[1])) {
$count = $arg[1]; // max count
return new \tts\services\log($file_name, $count);
return new \tts\log($file_name, $count);
}
if (! empty($file_name)) {
return new \tts\services\log($file_name);
return new \tts\log($file_name);
}
return new \tts\services\log();
return new \tts\log();
});
/* Contents of : on_session_encryption.php */
/**
* @author Robert Strutts <Robert@TryingToScale.com>
* @copyright Copyright (c) 2022, Robert Strutts.
* @license https://mit-license.org/
*/
\main_tts\registry::get('di')->register('session_encryption', function($args) {
\tts\registry::get('di')->register('session_encryption', function($args) {
try {
$key = \main_tts\configure::get('sessions', 'session_key');
return new \tts\services\paragon_crypto\sodium_storage($key);
return new \tts\sodium_storage(
\tts\configure::get('sessions', 'session_key')
);
} catch (\Exception $e) {
}
});
/* Contents of : on_templates.php */
\main_tts\registry::get('di')->register('templates', function(array $arg) {
\tts\registry::get('di')->register('templates', function(array $arg) {
$file_type = '.tpl';
if (isset($arg[0]) && is_string($arg[0])) {
$file_type = $arg[0];
}
return new \tts\services\liquid_templates($file_type);
return new \tts\liquid_templates($file_type);
});
/* Contents of : on_test_db.php */
\main_tts\registry::get('di')->register('db_mocker', function($args) {
\tts\registry::get('di')->register('db_mocker', function($args) {
try {
$conn = new \PDO('sqlite::memory:');
// set the PDO error mode to exception

@ -1,5 +1,5 @@
<?php
\main_tts\registry::get('di')->register('html_filter', function() {
return new \tts\services\html_filter();
\tts\registry::get('di')->register('html_filter', function() {
return new \tts\html_filter();
});

@ -1,6 +1,6 @@
<?php
\main_tts\registry::get('di')->register('log', function(array $arg) {
\tts\registry::get('di')->register('log', function(array $arg) {
$file_name = null;
if (isset($arg[0]) && is_string($arg[0])) {
$file_name = $arg[0]; // filename
@ -8,12 +8,12 @@
if (isset($arg[1]) && is_int($arg[1])) {
$count = $arg[1]; // max count
return new \tts\services\log($file_name, $count);
return new \tts\log($file_name, $count);
}
if (! empty($file_name)) {
return new \tts\services\log($file_name);
return new \tts\log($file_name);
}
return new \tts\services\log();
return new \tts\log();
});

@ -1,15 +1,10 @@
<?php
/**
* @author Robert Strutts <Robert@TryingToScale.com>
* @copyright Copyright (c) 2022, Robert Strutts.
* @license https://mit-license.org/
*/
\main_tts\registry::get('di')->register('session_encryption', function($args) {
\tts\registry::get('di')->register('session_encryption', function($args) {
try {
$key = \main_tts\configure::get('sessions', 'session_key');
return new \tts\services\paragon_crypto\sodium_storage($key);
return new \tts\sodium_storage(
\tts\configure::get('sessions', 'session_key')
);
} catch (\Exception $e) {
}

@ -1,9 +1,9 @@
<?php
\main_tts\registry::get('di')->register('templates', function(array $arg) {
\tts\registry::get('di')->register('templates', function(array $arg) {
$file_type = '.tpl';
if (isset($arg[0]) && is_string($arg[0])) {
$file_type = $arg[0];
}
return new \tts\services\liquid_templates($file_type);
return new \tts\liquid_templates($file_type);
});

@ -1,6 +1,6 @@
<?php
\main_tts\registry::get('di')->register('db_mocker', function($args) {
\tts\registry::get('di')->register('db_mocker', function($args) {
try {
$conn = new \PDO('sqlite::memory:');
// set the PDO error mode to exception

Loading…
Cancel
Save