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/template/template.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');
into::basic_class('user');

class template extends admin
{
	public function init()
	{
		global $G;
		$G['cover'] = $this->cover('template&market');
		into::basic_class('pages');
		$pages = $G['get']['pages'];
		$pages = is_numeric($pages)?$pages:1;
		$rows = $G['rows'] = $this->rows(20);
		$start = ($pages-1) * $rows;
		$end = $start + $rows;
		$data = array('total'=>0,'list'=>array(),'pages'=>array());
		$list = $this->local();
		foreach($list as $k=>$v){
			if($k>=$start && $k<$end){
				$json = into::load_json(ROOT_PATH.'system/web/theme/'.$v.'/config.json');
				$data['list'][$v]['path'] = $G['path']['relative'].'system/web/theme/'.$v.'/';
				$data['list'][$v]['image'] = $data['list'][$v]['path'].'image.png';
				$data['list'][$v]['name'] = $json['serial'];
				$data['list'][$v]['title'] = $json['title'];
				$data['list'][$v]['version'] = $json['version'];
			}
		}
		$data['total'] = count($list);
		$data['pages'] = pages::btns(ceil($data['total']/$rows), $pages);
		$data['names'] = implode(',',$list);
		echo $this->theme('template/template', $data);
	}
	
	public function local()
	{
		global $G;
		$template = array();
		$list = dir::read(ROOT_PATH.'system/web/theme/');
		foreach($list['dir'] as $v){
			if(is_file(ROOT_PATH.'system/web/theme/'.$v.'/config.json')){
				$template[] = $v;
			}
		}
		return $template;
	}
	
	public function modify()
	{
		global $G;
		$this->cover('template&market','M');
		if(preg_match('/^\w+$/',$G['get']['name'])){
			mysql::update(array('value'=>$G['get']['name']),'config',"name='web_theme'");
			alert('启用成功!',url::mpf('template','template','init',array('name'=>null)));
		}
		alert('启用失败!');
	}
	
	public function delete()
	{
		global $G;
		$this->cover('template&market','D');
		if(isset($G['post']['url']) && isset($G['get']['name'])){
			if($G['get']['name'] && preg_match("/^\w+$/",$G['get']['name'])){
				if(!mysql::total('config',"name='web_theme' AND value='{$G['get']['name']}' AND type='0' AND parent='0' AND lang=lang")){
					cache::remove('','user');
					dir::remove(ROOT_PATH.'system/web/theme/'.$G['get']['name'].'/');
					alert('删除成功',url::mpf('template','template','init'));
				}else{
					alert('模板使用中,不能删除');
				}
			}
		}
		alert('删除失败');
	}
}
?>