2024-01-18 23:13:02 +07:00
|
|
|
<?php
|
|
|
|
|
|
2024-01-28 10:53:31 +07:00
|
|
|
function debug_var($input) {
|
|
|
|
|
@ob_start();
|
|
|
|
|
print_r($input);
|
|
|
|
|
$content = ob_get_contents();
|
|
|
|
|
@ob_end_clean();
|
|
|
|
|
|
|
|
|
|
echo join("\r", ['<textarea cols="80" rows="20">', $content, '</textarea>']) ;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-18 23:13:02 +07:00
|
|
|
function init_autoload(){
|
|
|
|
|
$classLoader = require_once ROOT_DIR . '/package/vendor/autoload.php';
|
|
|
|
|
$classLoader->add("Hura8", ROOT_DIR . '/inc' );
|
|
|
|
|
|
|
|
|
|
return $classLoader;
|
|
|
|
|
}
|
2024-01-20 09:29:38 +07:00
|
|
|
|
|
|
|
|
//get current paging id
|
|
|
|
|
function getPageId(){
|
|
|
|
|
return getRequestInt('page', 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getPageSize($default=10){
|
|
|
|
|
return getRequestInt('pageSize', $default);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Function to get the post value in submit
|
|
|
|
|
function getPost($var, $default="", $encode = false, $keep_tag=""){
|
|
|
|
|
return isset($_POST[$var]) ? $_POST[$var] : $default;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Function to get the INTERGER request value of a variable
|
|
|
|
|
function getRequestInt($var, $min_value = 0){
|
|
|
|
|
$request = isset($_REQUEST[$var]) ? (int) $_REQUEST[$var] : (int) $min_value;
|
|
|
|
|
$request = ($request >= $min_value ) ? $request : $min_value; //if user tampers request parameter
|
|
|
|
|
return $request;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Function to get the request value of a variable
|
|
|
|
|
function getRequest($var, $default=""){
|
|
|
|
|
return $_REQUEST[$var] ?? $default;
|
|
|
|
|
}
|
|
|
|
|
|