raw_post & json

main
Robert 3 years ago
parent 4f86a4a84b
commit 2288b89a1d
  1. 2
      public/main.page
  2. 2
      src/documentation/chgrp_on_folders.txt
  3. 11
      src/mockup/inputs/app/home_in.php
  4. 2
      src/mockup/logic/app/home_logic.php
  5. 4
      src/mockup/outputs/app/home_out.php
  6. 2
      src/mockup/views/default/app/name_demo.php

@ -8,7 +8,7 @@ declare(strict_types=1);
* @license https://mit-license.org/ * @license https://mit-license.org/
*/ */
$show_all_startup_errors = true; // Always, Keep false on LIVE PROD SYS!! $show_all_startup_errors = false; // Always, Keep false on LIVE PROD SYS!!
if ($show_all_startup_errors) { if ($show_all_startup_errors) {
ini_set('display_errors', 1); ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 1);

@ -1,5 +1,3 @@
These are my suggestions to lock things down, make a group called let's say coders.
sudo find /var/www/tts_project/ -type f -exec chmod 664 {} \; sudo find /var/www/tts_project/ -type f -exec chmod 664 {} \;
sudo find /var/www/tts_project/ -type d -exec chmod 775 {} \; sudo find /var/www/tts_project/ -type d -exec chmod 775 {} \;

@ -22,18 +22,19 @@ class home_in {
*/ */
public static function name_demo(): array { public static function name_demo(): array {
\tts\safer_io::init_json(); // Staticly set JSON data if any
\tts\safer_io::grab_all_post_data();
$required_post_string_field = new IO(); $required_post_string_field = new IO();
$required_post_string_field->input_type = INPUTS::post; $required_post_string_field->input_type = INPUTS::json;
$required_post_string_field->field_filter = FIELD_FILTER::raw_string; $required_post_string_field->field_filter = FIELD_FILTER::raw_string;
$required_post_string_field->escape_html = HTML_FLAG::escape; $required_post_string_field->escape_html = HTML_FLAG::escape;
$required_post_string_field->validation_rule = 'required|max: 75'; $required_post_string_field->validation_rule = 'required|max: 75';
$required_post_string_field->use_db_filter = DB_FILTER::OFF; $required_post_string_field->use_db_filter = DB_FILTER::ON;
$required_post_string_field->skip_the_db = false; $required_post_string_field->skip_the_db = false;
$adult_post_int_age_field = new IO(); $adult_post_int_age_field = new IO();
$adult_post_int_age_field->input_type = INPUTS::post; $adult_post_int_age_field->input_type = INPUTS::json;
$adult_post_int_age_field->field_filter = FIELD_FILTER::integer_number; $adult_post_int_age_field->field_filter = FIELD_FILTER::integer_number;
$adult_post_int_age_field->validation_rule = 'greater_than: 18'; $adult_post_int_age_field->validation_rule = 'greater_than: 18';
$adult_post_int_age_field->validation_message = ['greater_than' => 'The %s must be an Adult over %d!']; $adult_post_int_age_field->validation_message = ['greater_than' => 'The %s must be an Adult over %d!'];

@ -10,7 +10,7 @@ class home_logic {
public static function name_demo(array & $input): void { public static function name_demo(array & $input): void {
$model = new \prj\mockup\models\app\home_model(\tts\registry::get('db')); $model = new \prj\mockup\models\app\home_model(\tts\registry::get('db'));
$submitted = true; $submitted = true;
foreach(SafeIO::logic_sanitize($input) as $data) { foreach(SafeIO::logic_sanitize($input) as $data) {
if (SafeIO::required_fields_were_NOT_all_submitted($data)) { if (SafeIO::required_fields_were_NOT_all_submitted($data)) {

@ -25,7 +25,9 @@ class home_out {
$errors[$key] = $html['errors'][$key]; $errors[$key] = $html['errors'][$key];
} }
} }
SafeIO::clear_post_data(); // Last use of Post
$age = $html_output['age'] ?? 0; $age = $html_output['age'] ?? 0;
$first_name = $html_output['first_name'] ?? "Unknown"; $first_name = $html_output['first_name'] ?? "Unknown";
$last_name = $html_output['last_name'] ?? "Unknown"; $last_name = $html_output['last_name'] ?? "Unknown";

@ -1,6 +1,6 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
$route_name_demo = "app/home"; $route_name_demo = "app/home";
$method_name_demo_post = "name_demo_post"; $method_name_demo_post = "name_demo_post";
?> ?>

Loading…
Cancel
Save