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/admin/tight/tight.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');

into::basic_class('admin');

class tight extends admin
{
	public function init()
	{
		global $G;
		$G['cover'] = $this->cover();
		$data = array();
		$path = ROOT_PATH.'system/web/common/tight/';
		$tight = dir::readall($path);
		$G['tight'] = json::decode($G['config']['tight']);
		foreach($tight as $v){
			$sign = str_replace('.json','',$v);
			$data[$sign] = array(
				'name' => $G['tight'][$sign],
				'sign' => $sign
			);
			ksort($data);
		}
		foreach($G['tight'] as $k=>$v){
			if(!$data[$k]){
				$data[$k] = array(
					'name' => $v,
					'sign' => $k
				);
				dir::create("{$path}{$k}.json",'[]');
			}
		}
		echo $this->theme('tight/tight', $data);
	}

	public function edit()
	{
		global $G;
		/* boss_CMS */
		$G['cover'] = $this->cover('tag');
		$data = array();
		if(isset($G['get']['id'])){
			$data = array(
				'name' => arrExist(json::decode($G['config']['tight']),$G['get']['id']),
				'sign' => $G['get']['id']
			);
		}
		echo $this->theme('tight/edit', $data);
	}

	public function add()
	{
		global $G;
		$G['cover'] = $this->cover('tight',$G['get']['id']?'M':'A');
		if(preg_match('/^\w+$/',$G['post']['sign'])){
			$path = ROOT_PATH.'system/web/common/tight/';
			$data = json::decode($G['config']['tight']);
			if(preg_match('/^\w+$/',$G['get']['id'])){
				if($G['get']['id'] != $G['post']['sign']){
					unset($data[$G['get']['id']]);
					dir::move("{$path}{$G['get']['id']}.json","{$path}{$G['post']['sign']}.json");
				}
			}else{
				if(!is_file("{$path}{$G['post']['sign']}.json")){
					dir::create("{$path}{$G['post']['sign']}.json");
				}
			}
			$data[$G['post']['sign']] = $G['post']['name'];		
			mysql::select_set(array('name'=>'tight','value'=>json::enfilter($data),'parent'=>'0','type'=>'0'),'config',array('value'));
			alert('修改成功', url::mpf('tight','tight','edit',array('success'=>'ok')));
		}else{
			alert('没有提交信息');
		}
	}

	public function import()
	{
		global $G;
		$G['cover'] = $this->cover('tight','R');
		$data = array();
		into::basic_json('tight');
		foreach($G['tight'] as $k=>$v){
			$data[] = array(
				'name' => $v['name'],
				'sign' => $k
			);
		}
		echo $this->theme('tight/import', $data);
	}

	public function put()
	{
		global $G;
		$this->cover('tight','M');
		if($G['post']['id']){
			$data = json::decode($G['config']['tight']);
			into::basic_json('tight');
			foreach($G['post']['id'] as $id){
				if(preg_match('/^\w+$/',$id) && $G['tight'][$id]){
					dir::create(ROOT_PATH.'system/web/common/tight/'.$id.'.json',json::encode($G['tight'][$id]['content']));
					$data[$id] = $G['post']['name_'.$id];
				}
			}
			mysql::select_set(array('name'=>'tight','value'=>json::enfilter($data),'parent'=>'0','type'=>'0'),'config',array('value'));
			alert('导入成功', url::mpf('tight','tight','init',array('success'=>'ok')));
		}
		alert('没有提交信息');
	}

	public function delete()
	{
		global $G;
		$this->cover('tight','D');
		if(isset($G['post']['url']) && isset($G['get']['id'])){
			$del = array();
			$arr = explode(',',$G['get']['id']);
			foreach($arr as $id){
				if(preg_match('/^\w+$/',$id)){
						$del[$id] = $id;
				}
			}
			if($del){
				$error=array();
				$path = ROOT_PATH.'system/web/common/tight/';
				$data = json::decode($G['config']['tight']);
				foreach($del as $sign){
					dir::delete("{$path}{$sign}.json");
					unset($data[$sign]);
				}
				mysql::select_set(array('name'=>'tight','value'=>json::enfilter($data),'parent'=>'0','type'=>'0'),'config',array('value'));
				alert('删除成功', url::mpf('tight','tight','init',array('id'=>null)));
			}else{
				alert('没有删除对象id');
			}			
		}
		alert('没有提交信息');
	}
}
?>