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/bb.cwoyt.com/Application/Home/Controller/ControlController.class.php
<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 赛脑 <2233759493@qq.com> <http://www.sn.com>
// +----------------------------------------------------------------------

namespace Home\Controller;

/**
 * 控制面板,仅管理员使用
 */
class ControlController extends HomeController {
	/* 控制面板首页 */
	public function index(){
		$this->display();
	}

	/* 站点设置 */
	public function setting(){
		if(IS_POST){ //提交数据
			$setting = I('post.web');
			if(empty($setting) || !is_array($setting)){
				$this->error('提交数据有误!');
			}

			/* 保存数据 */
			foreach ($setting as $name => $value) {
				$map = array('name' => $name);
				M('Setting')->where($map)->setField('value', $value);
			}

			$this->success('保存成功!', U('setting'));
		} else {
			$list = M('Setting')->getField('name,value');
			$this->assign('list', $list);
			$this->display();
		}
	}

	/* 频道管理 */
	public function channel(){
			/* 获取频道列表 */
			$map  = array('status' => 1);
			$list = D('Channel')->where($map)->select();
	
			$this->assign('list', $list);
			$this->display();
		}

	/* 分类列表 */
	public function category(){
		$tree = D('Category')->getTree();
		$this->assign('tree', $tree);
		C('_SYS_GET_CATEGORY_TREE_', true); //标记系统获取分类树模板
		$this->display();
	}

	/* 显示分类树,仅支持内部调 */
	public function categoryTree($tree = null){
		C('_SYS_GET_CATEGORY_TREE_') || $this->_empty();
		$this->assign('tree', $tree);
		$this->display('categorytree');
	}

	/* 编辑分类 */
	public function categoryEdit($id = null, $pid = 0){
		$Category = D('Category');

		if(IS_POST){ //提交表单
			if(false !== $Category->update()){
				$this->success('保存成功!');
			} else {
				$error = $Category->getError();
				$this->error(empty($error) ? '未知错误!' : $error);
			}
		} else {
			$cate = '';
			if($pid){
				/* 获取上级分类信息 */
				$cate = $Category->info($pid, 'id,name,title,status');
				if(!($cate && 1 == $cate['status'])){
					$this->error('指定的上级分类不存在或被禁用!');
				}
			}

			/* 获取分类信息 */
			$info = $id ? $Category->info($id) : '';

			$this->assign('info', $info);
			$this->assign('category', $cate);
			$this->display();
		}
	} 
}