public function Run()
 {
     //-- Session will be started also by set
     SmartSession::set('Samples_Benchmark_WithSession (just for admin)', true);
     //--
     //--
     $this->PageViewSetCfg('template-path', '@');
     // set template path to this module
     $this->PageViewSetCfg('template-file', 'template-benchmark.htm');
     // the default template
     //--
     //--
     $this->PageViewSetVar('title', 'Benchmark with Session Test URL');
     //--
     $this->PageViewSetVar('main', SmartMarkersTemplating::render_file_template($this->ControllerGetParam('module-path') . 'views/benchmark.htm', ['BENCHMARK-TITLE' => '[ Benchmark Test URL with PHP Session ]<br>use this URL to run a benchmark of this PHP framework with the PHP Session started ...']));
     //--
 }
 public function draw_image($y_form)
 {
     //--
     $y_form = trim((string) $y_form);
     //--
     //--
     $out = '';
     //--
     ob_start();
     //--
     if ((string) $this->mode == 'hashed') {
         $captcha_arr = (array) $this->generate_captcha_hashed();
     } else {
         // 'dotted'
         $captcha_arr = (array) $this->generate_captcha_dotted();
     }
     //end if else
     //--
     $captcha_image = $captcha_arr['rawimage'];
     $captcha_word = $captcha_arr['word'];
     $captcha_arr = array();
     //--
     $err = ob_get_contents();
     ob_end_clean();
     //--
     if ((string) $err != '') {
         // trigger errors
         Smart::log_warning('#Captcha / Draw Image [' . $intext . '] Errors/Output: ' . $err);
     }
     //end if
     //--
     ob_start();
     //-
     switch (@strtolower($this->format)) {
         case "png":
             //header: "Content-type: image/png"
             imagepng($captcha_image);
             break;
         case "gif":
             //header: "Content-type: image/gif"
             imagegif($captcha_image);
             break;
         case "jpg":
         case "jpeg":
         default:
             //header: "Content-type: image/jpeg"
             imagejpeg($captcha_image, '', $this->quality);
     }
     //end switch
     //-
     $out = ob_get_contents();
     //-
     ob_end_clean();
     //-
     @imagedestroy($captcha_image);
     // free resources
     //--
     //--
     @setcookie(SmartCaptchaFormCheck::chkcookiename($y_form), sha1($y_form . SMART_FRAMEWORK_SECURITY_KEY), 0, '/');
     //--
     if (SmartCaptchaFormCheck::validate_form_name($y_form) === 1) {
         if ((string) $this->store == 'session') {
             SmartSession::set(SmartCaptchaFormCheck::cookiename($y_form), SmartCaptchaFormCheck::checksum($captcha_word));
         } else {
             @setcookie(SmartCaptchaFormCheck::cookiename($y_form), SmartCaptchaFormCheck::checksum($captcha_word), 0, '/');
         }
         //end if else
     }
     //end if
     //--
     //--
     return $out;
     //--
 }
 /**
  * Start the Session on request
  *
  */
 public static function start()
 {
     //=====
     //--
     if (self::$started !== false) {
         return;
         // avoid start session if already started ...
     }
     //end if
     self::$started = true;
     // avoid run start again
     //--
     //=====
     //--
     $browser_os_ip_identification = SmartUtils::get_os_browser_ip();
     // get browser and os identification
     //--
     if ((string) $browser_os_ip_identification['bw'] == '@s#' or (string) $browser_os_ip_identification['bw'] == 'bot') {
         return;
         // in this case start no session for robots or the self browser (as they do not need to share info between many visits) ; if the self browser fail to identify will be at least identified as robot in the worst case
     }
     //end if
     //--
     //=====
     //-- no log as the cookies can be dissalowed by the browser
     if ((string) SMART_APP_VISITOR_COOKIE == '') {
         return;
         // session need cookies
     }
     //end if
     //--
     //=====
     //--
     $sf_sess_mode = 'files';
     $sf_sess_area = 'default-sess';
     $sf_sess_ns = 'unknown';
     $sf_sess_dir = 'tmp/sess';
     //--
     //=====
     if (!defined('SMART_FRAMEWORK_SESSION_PREFIX')) {
         Smart::log_warning('FATAL ERROR: Invalid Session Prefix :: SMART_FRAMEWORK_SESSION_PREFIX');
         return;
     }
     //end if
     if (strlen(SMART_FRAMEWORK_SESSION_PREFIX) < 3 or strlen(SMART_FRAMEWORK_SESSION_PREFIX) > 9) {
         Smart::log_warning('WARNING: Session Prefix must have a length between 3 and 9 characters :: SMART_FRAMEWORK_SESSION_PREFIX');
         return;
     }
     //end if
     if (!preg_match('/^[a-z\\-]+$/', (string) SMART_FRAMEWORK_SESSION_PREFIX)) {
         Smart::log_warning('WARNING: Session Prefix contains invalid characters :: SMART_FRAMEWORK_SESSION_PREFIX');
         return;
     }
     //end if
     //--
     if (!defined('SMART_FRAMEWORK_SESSION_NAME')) {
         Smart::log_warning('FATAL ERROR: Invalid Session Name :: SMART_FRAMEWORK_SESSION_NAME');
         return;
     }
     //end if
     if (strlen(SMART_FRAMEWORK_SESSION_NAME) < 10 or strlen(SMART_FRAMEWORK_SESSION_NAME) > 25) {
         Smart::log_warning('WARNING: Session Name must have a length between 10 and 25 characters :: SMART_FRAMEWORK_SESSION_NAME');
         return;
     }
     //end if
     if (!preg_match('/^[_A-Za-z0-9]+$/', (string) SMART_FRAMEWORK_SESSION_NAME)) {
         Smart::log_warning('WARNING: Session Name contains invalid characters :: SMART_FRAMEWORK_SESSION_NAME');
         return;
     }
     //end if
     if (!SmartFrameworkSecurity::ValidateVariableName(strtolower(SMART_FRAMEWORK_SESSION_NAME))) {
         Smart::log_warning('WARNING: Session Name have an invalid value :: SMART_FRAMEWORK_SESSION_NAME');
         return;
     }
     //end if
     //--
     if (!defined('SMART_FRAMEWORK_SESSION_LIFETIME')) {
         Smart::log_warning('FATAL ERROR: Invalid Session GC Lifetime :: SMART_FRAMEWORK_SESSION_LIFETIME');
         return;
     }
     //end if
     if (!is_int(SMART_FRAMEWORK_SESSION_LIFETIME)) {
         Smart::log_warning('Invalid INIT constant value for SMART_FRAMEWORK_SESSION_LIFETIME');
         return;
     }
     //end if
     //--
     if (!is_dir('tmp/sessions/')) {
         Smart::log_warning('FATAL ERROR: The Folder \'tmp/sessions/\' does not exists for use with Session !');
         return;
     }
     //end if
     //--
     $detected_session_mode = (string) ini_get('session.save_handler');
     if ((string) $detected_session_mode === 'files') {
         if ((string) SMART_FRAMEWORK_SESSION_HANDLER !== 'files') {
             Smart::log_warning('FATAL ERROR: The value set for SMART_FRAMEWORK_SESSION_HANDLER is not set to: files / but the value found in session.save_handler is: ' . $detected_session_mode);
             return;
         }
         //end if
     } elseif ((string) $detected_session_mode === 'user') {
         if ((string) SMART_FRAMEWORK_SESSION_HANDLER === 'files') {
             Smart::log_warning('FATAL ERROR: The value set for SMART_FRAMEWORK_SESSION_HANDLER is set to: files / but the value found in session.save_handler is: ' . $detected_session_mode);
             return;
         }
         //end if
     } else {
         Smart::log_warning('FATAL ERROR: The value set for session.save_handler must be set to one of these modes: files or user');
         return;
     }
     //end if
     //--
     //=====
     //--  generate a the client private key based on it's IP and Browser
     $the_sess_client_uuid = SmartUtils::unique_client_private_key();
     // SHA512 key to protect session data agains forgers
     //-- a very secure approach based on a chain, derived with a secret salt from the framework security key:
     // (1) an almost unique client private key lock based on it's IP and Browser
     // (2) an entropy derived from the client random cookie combined with the (1)
     // (3) a unique session name suffix derived from (1) and (2)
     // (4) a unique session id composed from (1) and (2)
     //-- thus the correlation between the random public client cookie, the session name suffix and the session id makes impossible to forge it as it locks to IP+Browser, using a public entropy cookie all encrypted with a secret key and derived and related, finally composed.
     $the_sess_client_lock = SmartHashCrypto::sha1(SMART_FRAMEWORK_SECURITY_KEY . '#' . $the_sess_client_uuid);
     $the_sess_client_entropy = SmartHashCrypto::sha1(SMART_APP_VISITOR_COOKIE . '*' . $the_sess_client_uuid . '%' . SMART_FRAMEWORK_SECURITY_KEY);
     $the_sess_nsuffix = SmartHashCrypto::sha1($the_sess_client_uuid . ':' . SMART_FRAMEWORK_SECURITY_KEY . '^' . $the_sess_client_entropy . '+' . $the_sess_client_lock . '$' . SMART_APP_VISITOR_COOKIE);
     $the_sess_id = $the_sess_client_entropy . '-' . $the_sess_client_lock;
     // session ID combines the secret client key based on it's IP / Browser and the Client Entropy Cookie
     //--
     $sf_sess_area = Smart::safe_filename((string) SMART_FRAMEWORK_SESSION_PREFIX);
     $sf_sess_dpfx = substr($the_sess_client_entropy, 0, 1) . '-' . substr($the_sess_client_lock, 0, 1);
     // this come from hexa so 3 chars are 16x16x16=4096 dirs
     //--
     if ((string) $browser_os_ip_identification['bw'] == '@s#') {
         $sf_sess_ns = '@sr-' . $sf_sess_dpfx;
     } elseif ((string) $browser_os_ip_identification['bw'] == 'bot') {
         $sf_sess_ns = 'r0-' . $sf_sess_dpfx;
         // we just need a short prefix for robots (on disk is costly for GC to keep separate folders, but of course, not so safe)
     } else {
         $sf_sess_ns = 'c-' . substr($browser_os_ip_identification['bw'], 0, 3) . '-' . $sf_sess_dpfx;
         // we just need a short prefix for clients (on disk is costly for GC to keep separate folders, but of course, not so safe)
     }
     //end if else
     $sf_sess_ns = Smart::safe_filename($sf_sess_ns);
     //-- by default set for files
     $sf_sess_mode = 'files';
     $sf_sess_dir = 'tmp/sessions/' . $sf_sess_area . '/' . $sf_sess_ns . '/';
     if ((string) $detected_session_mode === 'user') {
         if (class_exists('SmartCustomSession')) {
             if ((string) get_parent_class('SmartCustomSession') == 'SmartAbstractCustomSession') {
                 $sf_sess_mode = 'user-custom';
                 $sf_sess_dir = 'tmp/sessions/' . $sf_sess_area . '/';
                 // here the NS is saved in DB so we do not need to complicate paths
             } else {
                 Smart::log_warning('SESSION INIT ERROR: Invalid Custom Session Handler. The class SmartCustomSession must be extended from class SmartAbstractCustomSession ...');
                 return;
             }
             //end if else
         } else {
             Smart::log_warning('SESSION INIT ERROR: Custom Session Handler requires the class SmartCustomSession ...');
             return;
         }
         //end if
     }
     //end if
     $sf_sess_dir = Smart::safe_pathname($sf_sess_dir);
     //--
     if (!is_dir($sf_sess_dir)) {
         SmartFileSystem::dir_recursive_create($sf_sess_dir);
     }
     //end if
     SmartFileSystem::write_if_not_exists('tmp/sessions/' . $sf_sess_area . '/' . 'index.html', '');
     //=====
     //--
     @session_save_path($sf_sess_dir);
     @session_cache_limiter('nocache');
     //--
     $the_name_of_session = (string) SMART_FRAMEWORK_SESSION_NAME . '__Key_' . $the_sess_nsuffix;
     // protect session name data agains forgers
     //--
     @session_id((string) $the_sess_id);
     @session_name((string) $the_name_of_session);
     //--
     $tmp_exp_seconds = Smart::format_number_int(SMART_FRAMEWORK_SESSION_LIFETIME, '+');
     if ($tmp_exp_seconds > 0) {
         @session_set_cookie_params((int) $tmp_exp_seconds, '/');
         // session cookie expire and the path
     }
     // end if
     //-- be sure that session_write_close() is executed at the end of script if script if die('') premature and before pgsql shutdown register in the case of DB sessions
     register_shutdown_function('session_write_close');
     //-- handle custom session handler
     if ((string) $sf_sess_mode === 'user-custom') {
         //--
         $sess_obj = new SmartCustomSession();
         $sess_obj->sess_area = (string) $sf_sess_area;
         $sess_obj->sess_ns = (string) $sf_sess_ns;
         $sess_obj->sess_expire = (int) $tmp_exp_seconds;
         //--
         session_set_save_handler(array($sess_obj, 'open'), array($sess_obj, 'close'), array($sess_obj, 'read'), array($sess_obj, 'write'), array($sess_obj, 'destroy'), array($sess_obj, 'gc'));
         //--
     }
     //end if else
     //-- start session
     @session_start();
     //--
     if ((string) $_SESSION['SoftwareFramework_VERSION'] != (string) SMART_FRAMEWORK_VERSION or (string) $_SESSION['website_ID'] != (string) SMART_SOFTWARE_NAMESPACE or strlen($_SESSION['session_ID']) < 32) {
         //--
         $_SESSION['SoftwareFramework_VERSION'] = (string) SMART_FRAMEWORK_VERSION;
         // software version
         $_SESSION['SoftwareFramework_SessionMode'] = (string) $sf_sess_mode;
         // session mode
         $_SESSION['website_ID'] = (string) SMART_SOFTWARE_NAMESPACE;
         // the website ID
         $_SESSION['uniqbrowser_ID'] = (string) $the_sess_client_uuid;
         // a true unique browser ID (this is a protection against sessionID forgers)
         $_SESSION['session_ID'] = (string) @session_id();
         // read current session ID
         $_SESSION['session_STARTED'] = (string) date('Y-m-d H:i:s O');
         // read current session ID
         //--
     }
     //end if
     //--
     if (!isset($_SESSION['visit_COUNTER'])) {
         $_SESSION['visit_COUNTER'] = 1;
     } else {
         $_SESSION['visit_COUNTER'] += 1;
     }
     //end if else
     //--
     $_SESSION['SmartFramework__Browser__Identification__Data'] = (array) $browser_os_ip_identification;
     //--
     if ((string) $_SESSION['uniqbrowser_ID'] != (string) $the_sess_client_uuid) {
         // we need at least a md5 session
         //-- log, then unset old session (these are not well tested ...)
         Smart::log_notice('Session Security Breakpoint :: Session-BrowserUniqueID = ' . $_SESSION['uniqbrowser_ID'] . "\n" . 'SessionSecurityUniqueID = ' . $the_sess_client_uuid . "\n" . 'Browser Ident = ' . $browser_os_ip_identification['bw'] . "\n" . 'Cookies = ' . print_r($_COOKIE, 1) . "\n" . 'SessID = ' . $_SESSION['session_ID'] . "\n" . 'ClientIP = ' . SmartUtils::get_ip_client() . ' @ ' . $_SERVER['REMOTE_ADDR'] . "\n" . 'UserAgent = ' . $_SERVER['HTTP_USER_AGENT']);
         $_SESSION = array();
         // reset it
         //-- unset the cookie (from this below is tested)
         @setcookie($the_name_of_session, 'EXPIRED', 1, '/');
         //-- stop execution with message
         Smart::raise_error('SESSION // SECURITY BREAK POINT: Possible Session Forgery Detected ...', 'SESSION // SECURITY BREAK POINT: Possible Session Forgery Detected ! Please refresh the page ... A new session will be assigned ! If you are not trying to forge another user\' session this situation can occur also if you are behind a proxy and some of your navigation parameters has been changed ! If this problem persist try to restart your browser or use other browser. If still persist, contact the website administrator');
         die('');
         // just in case
         return;
         // or is better to silent discard it ?
         //--
     }
     //end if
     //--
     self::$active = time();
     // successfuly started
     //--
 }
 public function Run()
 {
     //--
     require_once 'lib/core/lib_smart_test_suite.php';
     // test suite
     //--
     //--
     SmartSession::start();
     // start the session
     //--
     //--
     if (SmartPersistentCache::isActive()) {
         SmartPersistentCache::getKey('test-unit', 'version');
         // just test if redis re-uses the connection ...
     }
     //end if
     //--
     //--
     $op = $this->RequestVarGet('op', 'testunit.main', 'string');
     //--
     switch ((string) $op) {
         case 'testunit.phpinfo':
             //--
             $this->PageViewSetCfg('rawpage', true);
             ob_start();
             phpinfo();
             $main = ob_get_contents();
             ob_end_clean();
             break;
         case 'testunit.captcha':
             //--
             $this->PageViewSetCfg('rawpage', 'yes');
             // should work both: true or 'yes'
             $this->PageViewSetCfg('rawmime', 'image/png');
             $this->PageViewSetCfg('rawdisp', 'inline');
             $main = SmartTestSuite::test_captcha('png');
             //--
             break;
         case 'testunit.post-form-by-ajax':
             //--
             sleep(1);
             $this->PageViewSetCfg('rawpage', true);
             $main = SmartTestSuite::post__answer__by__ajax($this->RequestVarGet('tab'), $this->RequestVarGet('frm'));
             //--
             break;
         case 'testunit.strings-test':
             //--
             sleep(1);
             $this->PageViewSetCfg('rawpage', true);
             $main = SmartTestSuite::test_strings();
             //--
             break;
         case 'testunit.crypto-test':
             //--
             sleep(1);
             $this->PageViewSetCfg('rawpage', true);
             $main = SmartTestSuite::test_crypto();
             //--
             break;
         case 'testunit.filesys-test':
             //--
             sleep(1);
             $this->PageViewSetCfg('rawpage', true);
             $main = SmartTestSuite::test_fs();
             //--
             break;
         case 'testunit.pgsql-server-test':
             //--
             sleep(1);
             $this->PageViewSetCfg('rawpage', true);
             $main = SmartTestSuite::test_pgsqlserver();
             //--
             break;
         case 'testunit.redis-server-test':
             //--
             sleep(1);
             $this->PageViewSetCfg('rawpage', true);
             $main = SmartTestSuite::test_redisserver();
             //--
             break;
         case 'testunit.json-sqlite3-smartgrid':
             //--
             $this->PageViewSetCfg('rawpage', true);
             //--
             $ofs = $this->RequestVarGet('ofs', 0, 'integer+');
             $sortby = $this->RequestVarGet('sortby', 'id', 'string');
             $sortdir = $this->RequestVarGet('sortdir', 'ASC', 'string');
             $sorttype = $this->RequestVarGet('sorttype', 'text', 'string');
             $src = $this->RequestVarGet('src', '', 'string');
             // filter var
             //--
             $main = SmartTestSuite::test_sqlite3_json_smartgrid($ofs, $sortby, $sortdir, $sorttype, $src);
             //--
             break;
         case 'testunit.html-editor':
             //--
             $this->PageViewSetCfg('template-file', 'template-modal.htm');
             $main = SmartComponents::js_init_away_page();
             $main .= SmartComponents::js_init_html_area();
             $main .= SmartComponents::js_draw_html_area('test_html_area', 'test_html_area', '', '920px', '500px');
             $main .= '<button class="ux-button" onClick="alert($(\'#test_html_area\').val());">Get HTML Source</button>';
             //--
             break;
         case 'testunit.code-editor':
             //--
             $this->PageViewSetCfg('template-file', 'template-modal.htm');
             $main = SmartComponents::js_init_away_page('The changes will be lost !');
             $main .= SmartComponents::js_init_editarea();
             $main .= SmartComponents::js_draw_editarea('test_code_editor', 'test_code_editor', '', 'html', true, '920px', '450px');
             //--
             break;
         case 'testunit.load-url-or-file':
             //--
             $this->PageViewSetCfg('rawpage', true);
             $main = SmartTestSuite::load__url__or__file('http://www.unix-world.org');
             //--
             break;
         case 'testunit.barcodes-qrcode':
             //--
             $this->PageViewSetCfg('rawpage', true);
             $main = SmartTestSuite::test_barcode2d_qrcode();
             //--
             break;
         case 'testunit.barcodes-semcode':
             //--
             $this->PageViewSetCfg('rawpage', true);
             $main = SmartTestSuite::test_barcode2d_datamatrix();
             //--
             break;
         case 'testunit.barcodes-pdf417':
             //--
             $this->PageViewSetCfg('rawpage', true);
             $main = SmartTestSuite::test_barcode2d_pdf417();
             //--
             break;
         case 'testunit.barcodes-code128':
             //--
             $this->PageViewSetCfg('rawpage', true);
             $main = SmartTestSuite::test_barcode1d_128B();
             //--
             break;
         case 'testunit.barcodes-code93':
             //--
             $this->PageViewSetCfg('rawpage', true);
             $main = SmartTestSuite::test_barcode1d_93();
             //--
             break;
         case 'testunit.barcodes-code39':
             //--
             $this->PageViewSetCfg('rawpage', true);
             $main = SmartTestSuite::test_barcode1d_39();
             //--
             break;
         case 'testunit.barcodes-rm4kix':
             //--
             $this->PageViewSetCfg('rawpage', true);
             $main = SmartTestSuite::test_barcode1d_kix();
             //--
             break;
         case 'testunit.charts-biz':
             //--
             $this->PageViewSetCfg('rawpage', true);
             $this->PageViewSetCfg('expires', 120);
             // cache expire test
             //--
             $chart = new SmartImgBizCharts('matrix', 'Marketing Chart', array('Chart 1' => array('red label' => array('x' => Smart::random_number(5, 7), 'y' => Smart::random_number(100, 120), 'z' => Smart::random_number(45, 75), 'color' => '#FF3300'), 'blue' => array('x' => Smart::random_number(100, 115), 'y' => Smart::random_number(200, 210), 'z' => Smart::random_number(20, 50), 'color' => '#003399'), 'green' => array('x' => Smart::random_number(150, 175), 'y' => Smart::random_number(250, 270), 'z' => Smart::random_number(2, 8), 'color' => '#33CC33', 'labelcolor' => '#11AA11'), 'yellow' => array('x' => Smart::random_number(400, 420), 'y' => Smart::random_number(70, 90), 'z' => Smart::random_number(50, 90), 'color' => '#FFCC00'), 'default' => array('x' => Smart::random_number(300, 325), 'y' => Smart::random_number(300, 320)))), 'png');
             $chart->width = 500;
             $chart->height = 500;
             $chart->axis_x_label = 'Relative Market Share';
             $chart->axis_y_label = 'Market Growth Rate';
             //--
             $this->PageViewSetCfg('rawmime', $chart->mime_header());
             $this->PageViewSetCfg('rawdisp', $chart->disposition_header());
             $main = $chart->generate();
             //--
             break;
         case 'testunit.charts-gfx':
             //--
             $this->PageViewSetCfg('rawpage', true);
             //--
             $showgraph2 = Smart::random_number(0, 1);
             $showgraphdepths = Smart::random_number(0, 1);
             $showtype = Smart::random_number(1, 6);
             switch ((string) $showtype) {
                 case 1:
                     $mode = 'vbars';
                     break;
                 case 2:
                     $mode = 'hbars';
                     break;
                 case 3:
                     $mode = 'dots';
                     break;
                 case 4:
                     $mode = 'lines';
                     break;
                 case 5:
                     $mode = 'pie';
                     break;
                 case 6:
                 default:
                     $mode = 'donut';
             }
             //end if
             //--
             $chart = new SmartImgGfxCharts($mode, "Type [" . $mode . "]", array(array('x' => "white", 'y' => Smart::random_number(10, 90), 'z' => Smart::random_number(10, 90), 'w' => 10, 'v' => '#ECECEC'), array('x' => "red", 'y' => 22.45, 'z' => Smart::random_number(10, 90), 'w' => 25, 'v' => '#FF3300'), array('x' => "blue", 'y' => Smart::random_number(10, 90), 'z' => Smart::random_number(10, 90), 'w' => 7, 'v' => '#003399'), array('x' => "yellow", 'y' => Smart::random_number(10, 90), 'z' => Smart::random_number(10, 90), 'w' => 17, 'v' => '#FFCC00'), array('x' => "green", 'y' => Smart::random_number(10, 90), 'z' => Smart::random_number(10, 90), 'w' => 31, 'v' => '#33CC33'), array('x' => "black", 'y' => Smart::random_number(10, 90), 'z' => Smart::random_number(10, 90), 'w' => 17, 'v' => '#333333')), 'png', $showgraph2, $showgraphdepths);
             $chart->axis_x = 'X-Axis';
             $chart->axis_y = 'Y-Axis';
             //--
             $this->PageViewSetCfg('rawmime', $chart->mime_header());
             $this->PageViewSetCfg('rawdisp', $chart->disposition_header());
             $main = $chart->generate();
             //--
             break;
         case 'testunit.ods':
             //--
             $this->PageViewSetCfg('rawpage', true);
             $oo = new SmartExportToOpenOffice();
             $this->PageViewSetCfg('rawmime', $oo->ODS_Mime_Header());
             $this->PageViewSetCfg('rawdisp', $oo->ODS_Disposition_Header('myfile.ods', 'attachment'));
             $main = $oo->ODS_SpreadSheet('A Table', array('<column 1>', 'column " 2', 'column & 3'), array('data 1.1', 'data 1.2', 1.3, 'data 2.1', 'data 2.2', 2.31), array('', '', 'decimal4'));
             //--
             break;
         case 'testunit.json-test':
             //--
             $mixed_data = ['Unicode Text' => '"Unicode78źź:ăĂîÎâÂșȘțȚşŞţŢグッド\'#@<tag>!$%^&*()-_=+' . "\r\n\t" . '</tag>', 'Numbers' => 1234567890.99, 'Boolean TRUE:' => true, 'Boolean FALSE:' => false];
             //--
             $main = '<h1> Json Test</h1>';
             $main .= '<pre style="background:#ECECEC; border:1px solid #CCCCCC; line-height:32px; padding:8px;">';
             $main .= '<b>Default (Unicode Unescaped) Json:</b>' . "\n" . Smart::json_encode($mixed_data) . "\n";
             $main .= '<hr>';
             $main .= '<b>Default (Unicode Unescaped) Json / Pretty Print:</b>' . "\n" . Smart::json_encode($mixed_data, true) . "\n";
             $main .= '<hr>';
             $main .= '<b>Unicode Escaped Json:</b>' . "\n" . Smart::json_encode($mixed_data, false, false) . "\n";
             $main .= '<hr>';
             $main .= '<b>Unicode Escaped Json / Pretty Print:</b>' . "\n" . Smart::json_encode($mixed_data, true, false) . "\n";
             $main .= '</pre>';
             //--
             break;
         case 'testunit.interractions':
             //--
             $this->PageViewSetCfg('template-file', 'template-modal.htm');
             $main = SmartTestSuite::test_interractions($this->RequestVarGet('mode'));
             //--
             break;
         case 'testunit.autocomplete':
             //--
             $src = $this->RequestVarGet('src', '', 'string');
             //--
             $this->PageViewSetCfg('rawpage', true);
             $main = SmartTestSuite::test_sqlite3_json_autocomplete($src);
             //--
             break;
         case 'testunit.main':
             //--
             $is_modal = false;
             if ($this->IfRequestModalPopup() or $this->IfRequestPrintable()) {
                 $is_modal = true;
                 $this->PageViewSetCfg('template-file', 'template-modal.htm');
             }
             //end if
             //--
             $main = SmartTestSuite::main_screen($this->RequestVarGet('tab'), $this->RequestVarGet('frm'), $this->RequestVarGet('testformdata'));
             //--
             if (!$is_modal) {
                 SmartTestSuite::test_load_libs();
                 // just for testing all libs
                 if ($this->IfDebug()) {
                     $this->SetDebugData('TestUnit.Main', 'Loading all staticload libs at once for test purposes ...');
                 }
                 //end if
             }
             //end if
             //--
             break;
         default:
             //--
             $this->PageViewSetCfg('error', 'Invalid TestUnit Operation ! ...');
             return 400;
             //--
     }
     //end switch
     //--
     //--
     $this->PageViewSetVars(array('title' => 'Test Suite', 'main' => $main));
     //--
 }