2023-04-11 09:21:20 +00:00
|
|
|
<?php
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('theme')) {
|
|
|
|
function theme()
|
|
|
|
{
|
|
|
|
return app(App\Core\Theme::class);
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('getName')) {
|
|
|
|
/**
|
|
|
|
* Get product name
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function getName()
|
|
|
|
{
|
|
|
|
return config('settings.KT_THEME');
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('addHtmlAttribute')) {
|
|
|
|
/**
|
|
|
|
* Add HTML attributes by scope
|
|
|
|
*
|
|
|
|
* @param $scope
|
|
|
|
* @param $name
|
|
|
|
* @param $value
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function addHtmlAttribute($scope, $name, $value)
|
|
|
|
{
|
|
|
|
theme()->addHtmlAttribute($scope, $name, $value);
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('addHtmlAttributes')) {
|
|
|
|
/**
|
|
|
|
* Add multiple HTML attributes by scope
|
|
|
|
*
|
|
|
|
* @param $scope
|
|
|
|
* @param $attributes
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function addHtmlAttributes($scope, $attributes)
|
|
|
|
{
|
|
|
|
theme()->addHtmlAttributes($scope, $attributes);
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('addHtmlClass')) {
|
|
|
|
/**
|
|
|
|
* Add HTML class by scope
|
|
|
|
*
|
|
|
|
* @param $scope
|
|
|
|
* @param $value
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function addHtmlClass($scope, $value)
|
|
|
|
{
|
|
|
|
theme()->addHtmlClass($scope, $value);
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('printHtmlAttributes')) {
|
|
|
|
/**
|
|
|
|
* Print HTML attributes for the HTML template
|
|
|
|
*
|
|
|
|
* @param $scope
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function printHtmlAttributes($scope)
|
|
|
|
{
|
|
|
|
return theme()->printHtmlAttributes($scope);
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('printHtmlClasses')) {
|
|
|
|
/**
|
|
|
|
* Print HTML classes for the HTML template
|
|
|
|
*
|
|
|
|
* @param $scope
|
|
|
|
* @param $full
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function printHtmlClasses($scope, $full = true)
|
|
|
|
{
|
|
|
|
return theme()->printHtmlClasses($scope, $full);
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('getSvgIcon')) {
|
|
|
|
/**
|
|
|
|
* Get SVG icon content
|
|
|
|
*
|
|
|
|
* @param $path
|
|
|
|
* @param $classNames
|
|
|
|
* @param $folder
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function getSvgIcon($path, $classNames = 'svg-icon', $folder = 'assets/media/icons/')
|
|
|
|
{
|
|
|
|
return theme()->getSvgIcon($path, $classNames, $folder);
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('setModeSwitch')) {
|
|
|
|
/**
|
|
|
|
* Set dark mode enabled status
|
|
|
|
*
|
|
|
|
* @param $flag
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function setModeSwitch($flag)
|
|
|
|
{
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('isModeSwitchEnabled')) {
|
|
|
|
/**
|
|
|
|
* Check dark mode status
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function isModeSwitchEnabled()
|
|
|
|
{
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('setModeDefault')) {
|
|
|
|
/**
|
|
|
|
* Set the mode to dark or light
|
|
|
|
*
|
|
|
|
* @param $mode
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function setModeDefault($mode)
|
|
|
|
{
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('getModeDefault')) {
|
|
|
|
/**
|
|
|
|
* Get current mode
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function getModeDefault()
|
|
|
|
{
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('setDirection')) {
|
|
|
|
/**
|
|
|
|
* Set style direction
|
|
|
|
*
|
|
|
|
* @param $direction
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function setDirection($direction)
|
|
|
|
{
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('getDirection')) {
|
|
|
|
/**
|
|
|
|
* Get style direction
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function getDirection()
|
|
|
|
{
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('isRtlDirection')) {
|
|
|
|
/**
|
|
|
|
* Check if style direction is RTL
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function isRtlDirection()
|
|
|
|
{
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('extendCssFilename')) {
|
|
|
|
/**
|
|
|
|
* Extend CSS file name with RTL or dark mode
|
|
|
|
*
|
|
|
|
* @param $path
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function extendCssFilename($path)
|
|
|
|
{
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('includeFavicon')) {
|
|
|
|
/**
|
|
|
|
* Include favicon from settings
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function includeFavicon()
|
|
|
|
{
|
|
|
|
return theme()->includeFavicon();
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('includeFonts')) {
|
|
|
|
/**
|
|
|
|
* Include the fonts from settings
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function includeFonts()
|
|
|
|
{
|
|
|
|
return theme()->includeFonts();
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('getGlobalAssets')) {
|
|
|
|
/**
|
|
|
|
* Get the global assets
|
|
|
|
*
|
|
|
|
* @param $type
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
function getGlobalAssets($type = 'js')
|
|
|
|
{
|
|
|
|
return theme()->getGlobalAssets($type);
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('addVendors')) {
|
|
|
|
/**
|
|
|
|
* Add multiple vendors to the page by name. Refer to settings KT_THEME_VENDORS
|
|
|
|
*
|
|
|
|
* @param $vendors
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function addVendors($vendors)
|
|
|
|
{
|
|
|
|
theme()->addVendors($vendors);
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('addVendor')) {
|
|
|
|
/**
|
|
|
|
* Add single vendor to the page by name. Refer to settings KT_THEME_VENDORS
|
|
|
|
*
|
|
|
|
* @param $vendor
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function addVendor($vendor)
|
|
|
|
{
|
|
|
|
theme()->addVendor($vendor);
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('addJavascriptFile')) {
|
|
|
|
/**
|
|
|
|
* Add custom javascript file to the page
|
|
|
|
*
|
|
|
|
* @param $file
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function addJavascriptFile($file)
|
|
|
|
{
|
|
|
|
theme()->addJavascriptFile($file);
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('addCssFile')) {
|
|
|
|
/**
|
|
|
|
* Add custom CSS file to the page
|
|
|
|
*
|
|
|
|
* @param $file
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function addCssFile($file)
|
|
|
|
{
|
|
|
|
theme()->addCssFile($file);
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('getVendors')) {
|
|
|
|
/**
|
|
|
|
* Get vendor files from settings. Refer to settings KT_THEME_VENDORS
|
|
|
|
*
|
|
|
|
* @param $type
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
function getVendors($type)
|
|
|
|
{
|
|
|
|
return theme()->getVendors($type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!function_exists('getCustomJs')) {
|
|
|
|
/**
|
|
|
|
* Get custom js files from the settings
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
function getCustomJs()
|
|
|
|
{
|
|
|
|
return theme()->getCustomJs();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!function_exists('getCustomCss')) {
|
|
|
|
/**
|
|
|
|
* Get custom css files from the settings
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
function getCustomCss()
|
|
|
|
{
|
|
|
|
return theme()->getCustomCss();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!function_exists('getHtmlAttribute')) {
|
|
|
|
/**
|
|
|
|
* Get HTML attribute based on the scope
|
|
|
|
*
|
|
|
|
* @param $scope
|
|
|
|
* @param $attribute
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
function getHtmlAttribute($scope, $attribute)
|
|
|
|
{
|
|
|
|
return theme()->getHtmlAttribute($scope, $attribute);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!function_exists('isUrl')) {
|
|
|
|
/**
|
|
|
|
* Get HTML attribute based on the scope
|
|
|
|
*
|
|
|
|
* @param $url
|
|
|
|
*
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
function isUrl($url)
|
|
|
|
{
|
|
|
|
return filter_var($url, FILTER_VALIDATE_URL);
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
if (!function_exists('image')) {
|
|
|
|
/**
|
|
|
|
* Get image url by path
|
|
|
|
*
|
|
|
|
* @param $path
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function image($path)
|
|
|
|
{
|
|
|
|
return asset('assets/media/' . $path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!function_exists('getIcon')) {
|
|
|
|
/**
|
|
|
|
* Get icon
|
|
|
|
*
|
|
|
|
* @param $path
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function getIcon($name, $class = '', $type = '')
|
|
|
|
{
|
|
|
|
return theme()->getIcon($name, $class, $type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function verify_user($id, $passwd, $SERVER_ADDR, $IPUserManager, $portUserManager, $appId)
|
2023-04-11 09:21:20 +00:00
|
|
|
{
|
2023-05-25 10:38:40 +00:00
|
|
|
|
|
|
|
$USERMANPROG = "user_verification.php";
|
|
|
|
$sock = fsockopen("tcp://" . $IPUserManager, $portUserManager, $errno, $errstr, 30);
|
|
|
|
|
|
|
|
|
|
|
|
if (!$sock) die("$errstr ($errno)\n");
|
|
|
|
|
|
|
|
$data = "appsid=" . urlencode($appId) . "&loginid=" . urlencode($id) . "&passwd=" . urlencode($passwd) . "&addr=" . $SERVER_ADDR . "&version=2";
|
|
|
|
|
|
|
|
//echo "data: $data <BR>";
|
|
|
|
|
|
|
|
fwrite($sock, "POST /user_verification_dev.php HTTP/1.0\r\n");
|
|
|
|
fwrite($sock, "Host: $IPUserManager\r\n");
|
|
|
|
fwrite($sock, "Content-type: application/x-www-form-urlencoded\r\n");
|
|
|
|
fwrite($sock, "Content-length: " . strlen($data) . "\r\n");
|
|
|
|
fwrite($sock, "Accept: */*\r\n");
|
|
|
|
fwrite($sock, "\r\n");
|
|
|
|
fwrite($sock, "$data\r\n");
|
|
|
|
fwrite($sock, "\r\n");
|
|
|
|
|
|
|
|
$headers = "";
|
|
|
|
while ($str = trim(fgets($sock, 4096))) $headers .= "$str\n";
|
|
|
|
|
|
|
|
$body = "";
|
|
|
|
while (!feof($sock)) $body .= fgets($sock, 4096);
|
|
|
|
|
|
|
|
|
|
|
|
fclose($sock);
|
|
|
|
|
|
|
|
return decompress($body);
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
function getAllowableScript($sessionMenu)
|
2023-04-11 09:21:20 +00:00
|
|
|
{
|
2023-05-25 10:38:40 +00:00
|
|
|
//$sessionMenu = $_SESSION['MENU'];
|
|
|
|
|
|
|
|
if (!empty($sessionMenu)) {
|
|
|
|
$tempMenuArrayLine = explode('-', $sessionMenu);
|
|
|
|
//print_r($tempMenuArrayLine);
|
|
|
|
if (count($tempMenuArrayLine) > 0) {
|
|
|
|
foreach ($tempMenuArrayLine as $tkey => $tval) {
|
|
|
|
$tempMenuArray = explode('|', $tval);
|
|
|
|
if (count($tempMenuArray) > 0) {
|
|
|
|
foreach ($tempMenuArray as $mkey => $mval) {
|
|
|
|
[$menukey, $menuval] = explode('>', $mval);
|
|
|
|
if ($menukey === 'LINK') {
|
|
|
|
$SCRIPT_ALLOW[$menuval] = 1;
|
|
|
|
}
|
|
|
|
//$menu[$menuCounter][$menukey] = $menuval;
|
|
|
|
}
|
|
|
|
//$menuCounter++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $SCRIPT_ALLOW;
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
function decompress($data)
|
|
|
|
{
|
|
|
|
$text = '';
|
|
|
|
$total = strlen($data);
|
|
|
|
for ($j = 0; $j < $total; $j = $j + 2) {
|
|
|
|
$text .= chr(hexdec(substr($data, $j, 2)));
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
return $text;
|
|
|
|
}
|
|
|
|
|
|
|
|
function compress($data)
|
2023-04-11 09:21:20 +00:00
|
|
|
{
|
2023-05-25 10:38:40 +00:00
|
|
|
$text = '';
|
|
|
|
$total = strlen($data);
|
|
|
|
for ($i = 0; $i < $total; $i++) {
|
|
|
|
$temp = dechex(ord(substr($data, $i, 1)));
|
|
|
|
if (strlen($temp) < 2) {
|
|
|
|
$temp = '0' . $temp;
|
|
|
|
}
|
|
|
|
$text .= $temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return $text;
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
function jsonToView($jsonText = '')
|
|
|
|
{
|
|
|
|
$arr = json_decode($jsonText, true);
|
|
|
|
$html = "";
|
|
|
|
if ($arr && is_array($arr)) {
|
|
|
|
$html .= _arrayToHtmlTableRecursive($arr);
|
|
|
|
}
|
|
|
|
return $html;
|
|
|
|
}
|
2023-04-11 09:21:20 +00:00
|
|
|
|
2023-05-25 10:38:40 +00:00
|
|
|
function _arrayToHtmlTableRecursive($arr)
|
2023-04-11 09:21:20 +00:00
|
|
|
{
|
2023-05-25 10:38:40 +00:00
|
|
|
$str = "<table><tbody>";
|
|
|
|
foreach ($arr as $key => $val) {
|
|
|
|
$str .= "<tr>";
|
|
|
|
$str .= "<td>$key</td>";
|
|
|
|
$str .= "<td>";
|
|
|
|
if (is_array($val)) {
|
|
|
|
if (!empty($val)) {
|
|
|
|
$str .= _arrayToHtmlTableRecursive($val);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$str .= "<strong>$val</strong>";
|
|
|
|
}
|
|
|
|
$str .= "</td></tr>";
|
|
|
|
}
|
|
|
|
$str .= "</tbody></table>";
|
|
|
|
|
|
|
|
return $str;
|
2023-04-11 09:21:20 +00:00
|
|
|
}
|