HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/bs.kntsleep.com/system/basic/class/into.class.php
<?php
/*
 * Copyright (c) Huyin Information Technology Co., Ltd. All Rights Reserved.
 * BOSSCMS Content Management System (https://www.bosscms.net/)
 */
defined('IS_OK') or exit('Access Forbidden');

class into
{
	/* 加载class类文件 */
	public static function load_class($type=null, $mold, $part, $func=null)
	{
		if(!isset($type)){
			$type = defined('IS_INSIDE')?'admin':'web';
		}
		if(!preg_match('/^[\w\/]+$/',$mold) || !preg_match('/^\w+$/',$part) || ($func&&!preg_match('/^\w+$/',$func))){
			die();
		}
		$file = SYSTEM_PATH.$type.'/'.$mold.'/'.$part.'.class.php';
		if(!is_file($file)){
			/* 尝试加载plugin插件路径下是否有文件 BOSSCMS */
			$plugin = SYSTEM_PATH.'plugin/'.$mold.'/'.$part.'.class.php';
			if(is_file($plugin)){
				$file = $plugin;
				if($mold == BOSSCMS_MOLD){
					define('IS_PLUGIN', true);
				}
			}else{
				$file = false;
			}
		}
		if($file){
			require_once $file;
			if(!class_exists($part)){
				return false;
			}
		}else{
			return false;
		}
		if(isset($func)){
			$class = new $part;
			if($func != 'new'){
				if(method_exists($class, $func)){
					call_user_func(array($class, $func));
				}
			}
			return $class;
		}
		return true;
	}
	
	/* 加载function方法文件 boss_cms */
	public static function load_func($path, $name=null)
	{
		$file = isset($name)?SYSTEM_PATH.$path.'/'.$name.'.func.php':$path;
		if(is_file($file)){
			require_once $file;
		}
	}
	
	/* 加载json数据文件 */
	public static function load_json($path, $name=null)
	{
		$file = isset($name)?SYSTEM_PATH.$path.'/'.$name.'.json':$path;
		if(is_file($file)){
			return json::get($file);
		}
	}
	
	/* 加载ini配置文件 b o s s c m s */
	public static function load_ini($path, $name=null)
	{
		$file = isset($name)?SYSTEM_PATH.$path.'/'.$name.'.ini.php':$path;
		if(is_file($file)){
			return parse_ini_file($file, true);
		}
	}
	
	
	public static function load()
	{
		return self::load_class(defined('BOSSCMS_TYPE')?BOSSCMS_TYPE:null, BOSSCMS_MOLD, BOSSCMS_PART, BOSSCMS_FUNC);
	}
	
	public static function basic_class($name, $func=null)
	{
		global $_CLASS;
		if(!isset($func)){
			$func = 'init';
			if(isset($_CLASS['basic'][$name]['init'])) return false;
		}
		$_CLASS['basic'][$name][$func] = true;
		return self::load_class('basic','class',$name, $func);
	}
	
	public static function basic_func($name)
	{
		return self::load_func('basic/func', $name);
	}
	
	public static function basic_json($name, $more=false, $cache=true)
	{
		global $G;
		if($more){
			$file = ROOT_PATH.'cache/json/'.substr(md5($name),8);
			if(is_file($file) && $cache){
				$data = json::get($file);
			}else{
				$data = self::load_json('basic/json', $name);
				$base = array();
				$basic = dir::read(ROOT_PATH.'system/basic/json/');
				foreach($basic['file'] as $v){
					if(preg_match('/^'.$name.'_\w+\.json$/',$v)){
						$base[] = ROOT_PATH.'system/basic/json/'.$v;
					}
				}
				$plugin = dir::read(ROOT_PATH.'system/plugin/');
				foreach($plugin['dir'] as $v){
					if(is_file($fdb = ROOT_PATH.'system/plugin/'.$v.'/'.$name.'.json')){
						$base[] = $fdb;
					}
				}
				foreach($base as $fi){
					if($json = json::get($fi)){
						foreach($json as $k=>$v){
							if(preg_match('/^\+/',$k)){
								$k = preg_replace('/^\+/','',$k);
								$data[$k] = $data[$k]+$v;
							}else if(is_numeric($k)){
								$data[] = $v;
							}else{
								$data[$k] = $v;
							}
						}
					}
				}
				switch($name){
					case 'database':
						$G['database'] = $data;
						if($res = page::models_list(true,'id,sign')){
							foreach($res as $v){
								foreach($G['database']['news'] as $k2=>$v2){
									$data['model_'.$v['sign']][$k2] = $v2;
								}
								$sign = 'model_'.$v['sign'].'_content';
								foreach($G['database']['news_content'] as $k2=>$v2){
									if(!preg_match('/\/\*.+\*\//',$v2)){
										$data[$sign][$k2] = $v2;
									}
								}
								if($field = page::field($v['id'],'name,type,title')){
									foreach($field as $v2){
										$data[$sign][$v2['name']] = $v2['type'].' NOT NULL';
										if(preg_match('/^varchar/',$v2['type'])){
											$data[$sign][$v2['name']] .= " DEFAULT ''";
										}else if(preg_match('/^int/',$v2['type'])){
											$data[$sign][$v2['name']] .= " DEFAULT '0'";
										}
										$data[$sign][$v2['name']] .= " COMMENT '{$v2['title']}'";
									}
								}
							}
						}
						foreach($data as $key=>$val){
							$data['database_column'][$key] = implode(',',array_keys($val));
						}
						break;
					case 'option':
						if($res = page::models_list(false,'id,name')){
							foreach($res as $v){
								$data['type'][$v['id']] = $v['name'];
							}
						}
						break;
					case 'pass':
						if($res = page::models_list(true,'id,sign')){
							foreach($res as $v){
								$data['type']['model_'.$v['sign']] = $v['id'];
							}
						}
						break;
				}
				dir::create($file, json::encode($data));
			}
			if($name=='database'){
				$G['database_column'] = $data['database_column'];
				unset($data['database_column']);
			}
			$G[$name] = $data;
		}else{
			$G[$name] = self::load_json('basic/json', $name);
		}
	}
	
	public static function basic_ini($name)
	{
		global $G;
		$G[$name] = self::load_ini('basic/ini', $name);
	}
}

?>