/** * 后台首页 */ public function main() { // 首次安装系统-跳转到欢迎界面-并安装默认模块 if ($this->dcache->get('install')) { $this->admin_msg('首次安装系统,正在为您安装模块初始化数据', dr_url('home/init'), 2); exit; } $store = array(); // 搜索本地模块 $local = @array_diff(dr_dir_map(FCPATH, 1), array('app', 'cache', 'config', 'dayrui', 'member', 'space', 'player')); if ($local) { foreach ($local as $dir) { if (is_file(FCPATH . $dir . '/config/module.php')) { $config = (require FCPATH . $dir . '/config/module.php'); if ($config['key']) { if (isset($store[$config['key']])) { if (version_compare($config['version'], $store[$config['key']], '<')) { $store[$config['key']] = $config['version']; } } else { $store[$config['key']] = $config['version']; } } } } } // 搜索本地应用 $local = dr_dir_map(FCPATH . 'app/', 1); if ($local) { foreach ($local as $dir) { if (is_file(FCPATH . 'app/' . $dir . '/config/app.php')) { $config = (require FCPATH . 'app/' . $dir . '/config/app.php'); if ($config['key']) { $store[$config['key']] = $config['version']; } } } } // 判断管理员ip状况 $ip = ''; $login = $this->db->where('uid', $this->uid)->order_by('logintime desc')->limit(2)->get('admin_login')->result_array(); if ($login && count($login) == 2 && $login[0]['loginip'] != $login[1]['loginip']) { $this->load->library('dip'); $now = $this->dip->address($login[0]['loginip']); $last = $this->dip->address($login[1]['loginip']); if (@strpos($now, $last) === FALSE && @strpos($last, $now) === FALSE) { // Ip异常判断 $ip = dr_lang('html-022', $login[1]['loginip'], $last, dr_url('root/log', array('uid' => $this->uid))); } } // 统计模块数据 $total = array(); $module = $this->get_module(SITE_ID); if ($module) { // 查询模块的菜单 $top = array(); $menu = $this->db->where('pid=0')->where('hidden', 0)->order_by('displayorder ASC,id ASC')->get('admin_menu')->result_array(); if ($menu) { foreach ($menu as $t) { list($a, $dir) = @explode('-', $t['mark']); if ($dir && !$module[$dir]) { continue; } $top[$dir] = $t['id']; } } // 判断审核权限 if ($this->admin['adminid'] != 1) { $my = $this->_get_verify(); $my = $my[$this->admin['adminid']]; } foreach ($module as $dir => $mod) { // 判断模块表是否存在 if (!$this->site[SITE_ID]->query("SHOW TABLES LIKE '%" . $this->db->dbprefix(SITE_ID . '_' . $dir . '_verify') . "%'")->row_array()) { continue; } // $topid = intval($top[$dir]); $total[$dir] = array('name' => $mod['name'], 'today' => $this->_set_k_url($topid, dr_url($dir . '/home/index')), 'content' => $this->_set_k_url($topid, dr_url($dir . '/home/index')), 'content_verify' => $this->_set_k_url($topid, dr_url($dir . '/home/verify')), 'extend_verify' => 'javascript:;', 'add' => $this->_set_k_url($topid, dr_url($dir . '/home/add')), 'url' => $mod['url']); if ($this->admin['adminid'] == 1) { // 扩展审核数据 if (is_file(FCPATH . $dir . '/config/extend.main.table.php')) { $total[$dir]['extend_verify'] = $this->_set_k_url($topid, dr_url($dir . '/verify/index')); } } else { if (!$my) { continue; } if (is_file(FCPATH . $dir . '/config/extend.main.table.php')) { $total[$dir]['extend_verify'] = $this->_set_k_url($topid, dr_url($dir . '/verify/index')); } } } $total['member'] = array('name' => lang('364'), 'today' => $this->_set_k_url(3, dr_url('member/home/index')), 'content' => $this->_set_k_url(3, dr_url('member/home/index')), 'content_verify' => $this->_set_k_url(3, dr_url('member/home/index')), 'extend_verify' => 'javascript:;', 'add' => $this->_set_k_url(3, dr_url('member/home/index')), 'url' => $this->_set_k_url(3, dr_url('member/home/index'))); } $this->template->assign(array('ip' => $ip, 'sip' => $this->_get_server_ip(), 'store' => dr_base64_encode(dr_array2string($store)), 'mtotal' => $total, 'sqlversion' => $this->db->version())); $this->template->display('main.html'); }
/** * 更新 */ public function update() { $key = 0; $dir = $this->input->get('id'); if (is_file(FCPATH . 'app/' . $dir . '/config/app.php')) { $config = (require FCPATH . 'app/' . $dir . '/config/app.php'); $key = (int) $config['key']; } if (!$key) { $this->admin_msg('此应用无法在线更新(key不存在)'); } $url = 'http://store.dayrui.com/index.php?c=down&m=update&action=application¶m=' . dr_base64_encode(dr_array2string(array('site' => SITE_URL, 'name' => SITE_NAME, 'data' => array('id' => $key, 'dir' => $dir, 'version' => $config['version']), 'admin' => SELF, 'domain' => SITE_URL, 'version' => DR_VERSION_ID))); $this->template->assign(array('url' => $url)); $this->template->display('online.html'); }
public function store() { $this->template->assign(array('url' => 'http://store.dayrui.com/index.php?c=category&id=2&action=application¶m=' . dr_base64_encode(dr_array2string(array('site' => SITE_URL, 'name' => SITE_NAME, 'admin' => SELF, 'version' => DR_VERSION_ID))))); $this->template->display('online.html'); }