Ejemplo n.º 1
0
 /**
  * 2.3.1 更新程序
  */
 public function index()
 {
     $this->admin_msg('升级完成,请更新全站缓存在刷新页面', '', 1);
     if (DR_VERSION_ID != 16) {
         //$this->admin_msg('升级完成,请更新全站缓存在刷新页面', '', 1);
     }
     //
     $page = (int) $this->input->get('page');
     if (!$page) {
         $this->admin_msg('正在升级数据...', dr_url('update/index', array('page' => $page + 1)), 2);
     }
     switch ($page) {
         case 1:
             $data = $this->db->get('site')->result_array();
             if ($data) {
                 $field = $this->db->dbprefix('field');
                 foreach ($data as $t) {
                     $table = $this->db->dbprefix($t['id'] . '_navigator');
                     $this->db->query('ALTER TABLE `' . $table . '` ADD `childids` TEXT NULL DEFAULT NULL AFTER `child`;');
                     $this->db->query('ALTER TABLE `' . $table . '` ADD `pids` TEXT NULL DEFAULT NULL AFTER `pid`;');
                     $this->db->query('ALTER TABLE `' . $table . '` ADD `mark` VARCHAR(50) NOT NULL AFTER `show`;');
                     $this->db->query('ALTER TABLE `' . $table . '` ADD `extend` INT(1) DEFAULT NULL AFTER `mark`;');
                     $this->db->query('ALTER TABLE `' . $table . '` ADD INDEX (`mark`) ;');
                     $this->db->query('ALTER TABLE `' . $table . '` ADD INDEX (`extend`) ;');
                 }
             }
             $this->admin_msg('正在升级网站导航表结构...', dr_url('update/index', array('page' => $page + 1)), 2);
             break;
         default:
             $this->admin_msg('升级完成,请更新全站缓存在刷新页面', '', 1);
             break;
     }
 }
Ejemplo n.º 2
0
 /**
  * 菜单管理
  */
 public function index()
 {
     if (IS_POST) {
         $ids = $this->input->post('ids');
         if (!$ids) {
             exit(dr_json(0, lang('013')));
         }
         // 可以不用判断权限
         if ($this->input->post('action') == 'order') {
             $_data = $this->input->post('data');
             foreach ($ids as $id) {
                 $this->db->where('id', $id)->update('admin_menu', array('displayorder' => (int) $_data[$id]['displayorder']));
             }
             $this->menu_model->cache();
             $this->system_log('排序后台菜单项【#' . @implode(',', $ids) . '】');
             // 记录日志
             exit(dr_json(1, lang('339')));
         } else {
             $this->menu_model->delete($ids);
             $this->system_log('删除后台菜单项【#' . @implode(',', $ids) . '】');
             // 记录日志
             $this->menu_model->cache();
             exit(dr_json(1, lang('339')));
         }
     }
     $this->load->library('dtree');
     $this->dtree->icon = array('   │ ', '   ├─ ', '   └─ ');
     $this->dtree->nbsp = '   ';
     $left = $this->menu_model->get_left_id();
     $data = $this->db->order_by('displayorder ASC,id ASC')->get('admin_menu')->result_array();
     $tree = array();
     if ($data) {
         foreach ($data as $t) {
             $t['name'] = '<i class="' . $t['icon'] . '"></i> ' . $t['name'];
             $t['option'] = '';
             if ($this->is_auth('admin/menu/add') && !in_array($t['pid'], $left)) {
                 $t['option'] .= '<a class="add" title="' . lang('add') . '" href="' . dr_dialog_url(dr_url('menu/add', array('pid' => $t['id'])), 'add') . '"></a>&nbsp;&nbsp;';
             } else {
                 $t['option'] .= '<a class="add" style="background:none" href="javascript:;"></a>&nbsp;&nbsp;';
             }
             if ($this->is_auth('admin/menu/edit')) {
                 $t['hidden'] = '<a href="javascript:;" onClick="return dr_dialog_set(\'' . ($t['hidden'] ? lang('html-161') : lang('html-162')) . '\',\'' . dr_url('menu/hidden', array('id' => $t['id'])) . '\');"><img src="/dayrui/statics/images/' . ($t['hidden'] ? 0 : 1) . '.gif"></a>';
             } else {
                 $t['hidden'] = '<img src="/dayrui/statics/images/' . ($t['hidden'] ? 0 : 1) . '.gif">';
             }
             if ($this->is_auth('admin/menu/edit')) {
                 $t['option'] .= '<a class="edit" title="' . lang('edit') . '" href="' . dr_dialog_url(dr_url('menu/edit', array('id' => $t['id'])), 'edit') . '"></a>&nbsp;&nbsp;';
                 $t['name'] = '<a title="' . lang('edit') . '" href="' . dr_dialog_url(dr_url('menu/edit', array('id' => $t['id'])), 'edit') . '">' . $t['name'] . '</a>&nbsp;&nbsp;';
             }
             if ($this->is_auth('admin/menu/del')) {
                 $t['option'] .= '<a class="del" title="' . lang('del') . '" href="javascript:;" onClick="return dr_dialog_del(\'' . lang('015') . '\',\'' . dr_url('menu/del', array('id' => $t['id'])) . '\');"></a>&nbsp;&nbsp;';
             }
             $tree[$t['id']] = $t;
         }
     }
     $str = "<tr>\n\t\t\t\t\t<td align='right'><input name='ids[]' type='checkbox' class='dr_select' value='\$id' />&nbsp;</td>\n\t\t\t\t\t<td align='center'><input class='input-text displayorder' type='text' name='data[\$id][displayorder]' value='\$displayorder' /></td>\n\t\t\t\t\t<td align='center'>\$hidden</td>\n\t\t\t\t\t<td>\$spacer\$name</td>\n\t\t\t\t\t<td align='left'>\$option</td>\n\t\t\t\t</tr>";
     $this->dtree->init($tree);
     $this->template->assign(array('list' => $this->dtree->get_tree(0, $str)));
     $this->template->display('menu_index.html');
 }
Ejemplo n.º 3
0
 /**
  * 管理
  */
 public function index()
 {
     if (IS_POST) {
         $ids = $this->input->post('ids');
         if (!$ids) {
             exit(dr_json(0, lang('013')));
         } elseif (!$this->is_auth('admin/poster/del')) {
             exit(dr_json(0, lang('160')));
         }
         $this->link->where_in('id', $ids)->delete($this->table);
         $this->poster_model->delete('sid IN(' . @implode(',', $ids) . ')');
         $this->system_log('删除广告位【#' . @implode(',', $ids) . '】');
         // 记录日志
         $this->cache(1);
         exit(dr_json(1, lang('000')));
     }
     $data = array();
     $page = max(1, (int) $_GET['page']);
     $total = $_GET['total'] ? $_GET['total'] : $this->link->count_all_results($this->table);
     $order = isset($_GET['order']) && strpos($_GET['order'], "undefined") !== 0 ? $_GET['order'] : 'id DESC';
     if ($total) {
         $data = $this->link->order_by($order)->limit(SITE_ADMIN_PAGESIZE, SITE_ADMIN_PAGESIZE * ($page - 1))->get($this->table)->result_array();
     }
     $param = array('total' => $total, 'order' => $order);
     $this->template->assign(array('list' => $data, 'type' => $this->type, 'total' => $param['total'], 'pages' => $this->get_pagination(dr_url('poster/index', $param), $param['total'])));
     $this->template->display('poster_index.html');
 }
Ejemplo n.º 4
0
 /**
  * 管理
  */
 protected function admin_index()
 {
     if (IS_POST) {
         if (!$this->is_auth(APP_DIR . '/admin/tag/del')) {
             exit(dr_json(0, lang('160')));
         }
         $id = $this->input->post('ids');
         if ($id) {
             $this->link->where_in('id', $id)->delete($this->tag_model->tablename);
         }
         $this->system_log('删除站点【#' . SITE_ID . '】模块【' . APP_DIR . '】Tag内容【#' . @implode(',', $id) . '】');
         // 记录日志
         exit(dr_json(1, lang('000')));
     }
     // 数据库中分页查询
     $kw = $this->input->get('kw') ? $this->input->get('kw') : '';
     list($data, $param) = $this->tag_model->limit_page($kw, max((int) $this->input->get('page'), 1), (int) $this->input->get('total'));
     // 菜单选择
     if (isset($_GET['kw'])) {
         $this->template->assign('menu', $this->get_menu(array(lang('125') => APP_DIR . '/admin/tag/index/kw/', lang('add') => APP_DIR . '/admin/tag/add_js')));
     } else {
         $this->_menu();
     }
     $this->template->assign(array('mod' => $this->module, 'list' => $data, 'param' => $param, 'pages' => $this->get_pagination(dr_url(APP_DIR . '/tag/index', $param), $param['total'])));
     $this->template->display('tag_index.html');
 }
Ejemplo n.º 5
0
 /**
  * 版本检测
  */
 private function _version()
 {
     $id = (int) dr_catcher_data('http://www.omooo.com/index.php?c=sys&m=now');
     if ($id && DR_VERSION_ID < $id) {
         return $this->halt("您的当前版本过低,为了您网站的安全性,请立即升级到官方最新版本,<a style='color:red' href='" . dr_url('upgrade/index') . "'><b>这里升级</b></a>", 0);
     }
 }
Ejemplo n.º 6
0
 /**
  * 删除
  */
 public function del()
 {
     $id = (int) $this->input->get('id');
     $this->form_model->del($id);
     $this->system_log('删除网站表单【#' . $id . '】');
     // 记录日志
     $this->admin_msg(lang('000'), dr_url('form/index'), 1);
 }
Ejemplo n.º 7
0
 /**
  * 删除收货地址
  */
 public function del()
 {
     $id = (int) $this->input->get('id');
     $this->db->where('id', $id)->where('uid', $this->uid)->delete('member_address');
     if (IS_AJAX) {
         exit(dr_json(1, lang('000')));
     }
     $this->member_msg(lang('000'), dr_url('address/index'), 1);
 }
Ejemplo n.º 8
0
 /**
  * 执行
  */
 public function execute()
 {
     $id = (int) $this->input->get('id');
     $data = $this->db->where('id', $id)->limit(1)->get('cron_queue')->row_array();
     if (!$data) {
         $this->admin_msg(lang('019'));
     }
     $this->cron_model->execute($data);
     $this->admin_msg(lang('000'), dr_url('cron/index'), 1);
 }
Ejemplo n.º 9
0
 /**
  * 修改
  */
 public function edit()
 {
     $id = (int) $this->input->get('id');
     $data = $this->db->where('id', $id)->limit(1)->get('urlrule')->row_array();
     if (!$data) {
         $this->admin_msg(lang('019'));
     }
     if (IS_POST) {
         $this->db->where('id', $id)->update('urlrule', array('name' => $this->input->post('name'), 'value' => dr_array2string($this->input->post('data'))));
         $this->cache(1);
         $this->admin_msg(lang('000'), dr_url('urlrule/index'), 1);
     }
     $data['value'] = dr_string2array($data['value']);
     $this->template->assign(array('data' => $data));
     $this->template->display('urlrule_add.html');
 }
Ejemplo n.º 10
0
 /**
  * 我的订单
  */
 public function index()
 {
     if (IS_POST && $this->input->post('action')) {
         $ids = $this->input->post('ids', TRUE);
         if (!$ids) {
             exit(dr_json(0, lang('013')));
         }
         if ($this->input->post('action') == 'del') {
             if (!$this->is_auth(APP_DIR . 'admin/format/del')) {
                 exit(dr_json(0, lang('160')));
             }
             $this->link->where_in('id', $ids)->delete($this->order_model->tablename);
             $this->link->where_in('fid', $ids)->delete($this->order_model->dataname);
             $this->order_model->cache();
             exit(dr_json(1, lang('000')));
         } else {
             if (!$this->is_auth(APP_DIR . 'admin/format/edit')) {
                 exit(dr_json(0, lang('160')));
             }
             $_data = $this->input->post('data');
             foreach ($ids as $id) {
                 $this->link->where('id', $id)->update($this->order_model->tablename, $_data[$id]);
             }
             $this->order_model->cache();
             exit(dr_json(1, lang('000')));
         }
     } else {
         // 执行关闭过期订单操作
         $this->order_model->close_order();
     }
     // 根据参数筛选结果
     $param = array();
     if ($this->input->get('search')) {
         $param['search'] = 1;
     }
     // 数据库中分页查询
     list($data, $param) = $this->order_model->limit_page($param, max((int) $this->input->get('page'), 1), (int) $this->input->get('total'));
     if ($this->input->get('search')) {
         $_param = $this->cache->file->get($this->order_model->cache_file);
     } else {
         $_param = $this->input->post('data');
     }
     $_param = $_param ? $param + $_param : $param;
     $this->template->assign(array('list' => $data, 'pages' => $this->get_pagination(dr_url(APP_DIR . '/order/index', $param), $param['total']), 'param' => $_param, 'menu' => $this->get_menu(array(lang('my-31') => APP_DIR . '/admin/order/index')), 'paytype' => $this->order_model->get_pay_type()));
     $this->template->display('order_index.html');
 }
Ejemplo n.º 11
0
 /**
  * 首页
  */
 public function index()
 {
     $uid = (int) $this->input->get('uid');
     // 根据参数筛选结果
     $param = array('uid' => $uid, 'type' => 0);
     if ($this->input->get('search')) {
         $param['search'] = 1;
     }
     // 数据库中分页查询
     list($data, $param) = $this->score_model->limit_page($param, max((int) $this->input->get('page'), 1), (int) $this->input->get('total'));
     $param['uid'] = $uid;
     if ($this->input->get('search')) {
         $_param = $this->cache->file->get($this->score_model->cache_file);
     } else {
         $_param = $this->input->post('data');
     }
     $_param = $_param ? $param + $_param : $param;
     $this->template->assign(array('list' => $data, 'name' => SITE_EXPERIENCE, 'param' => $_param, 'pages' => $this->get_pagination(dr_url('member/experience/index', $param), $param['total'])));
     $this->template->display('score_index.html');
 }
Ejemplo n.º 12
0
 /**
  * 空间资料
  */
 public function index()
 {
     $error = NULL;
     $field = array();
     $MEMBER = $this->get_cache('member');
     $field[] = $MEMBER['spacefield']['name'];
     if ($MEMBER['spacefield'] && $MEMBER['group'][$this->member['groupid']]['spacefield']) {
         foreach ($MEMBER['spacefield'] as $t) {
             if (in_array($t['fieldname'], $MEMBER['group'][$this->member['groupid']]['spacefield'])) {
                 $field[] = $t;
             }
         }
     }
     define('IS_SPACE_THEME', $this->space['style'] ? $this->space['style'] : 'default');
     if (IS_POST) {
         $post = $this->validate_filter($field, $this->space);
         if (isset($post['error'])) {
             $data = $this->input->post('data', TRUE);
             $error = $post['msg'];
         } else {
             $error = $this->space_model->update($this->uid, $this->member['groupid'], $post[1]);
             if ($error) {
                 $this->attachment_handle($this->uid, $this->db->dbprefix('space') . '-' . $this->uid, $field, $this->space);
             }
             if ($error == 0) {
                 // 名称重复
                 $error = lang('m-239');
             } elseif ($error == 1) {
                 // 操作成功
                 $this->member_msg(lang('000'), dr_url('space/index'), 1);
             } else {
                 // 操作成功,等待审核
                 $this->member_msg(lang('m-240'), dr_url('space/index'), 2);
             }
         }
     } else {
         $data = $this->space;
     }
     $this->template->assign(array('data' => $data, 'field' => $field, 'myfield' => $this->field_input($field, $data, FALSE, 'uid'), 'newspace' => $this->space ? 0 : 1, 'result_error' => $error));
     $this->template->display('space_index.html');
 }
Ejemplo n.º 13
0
 /**
  * 虚拟卡兑换
  */
 public function convert()
 {
     $error = '';
     if (IS_POST) {
         $score = abs((int) $this->input->post('score'));
         $money = (double) $score / SITE_CONVERT;
         if (!$score) {
             $error = lang('m-227');
         } elseif ($money > $this->member['money']) {
             $error = lang('m-210');
         } else {
             // 虚拟币增加
             $this->member_model->update_score(1, $this->uid, $score, '', 'lang,m-226');
             // 人民币减少
             $this->pay_model->add($this->uid, -$money, 'lang,m-228,' . $score);
             $this->member_msg(lang('m-225'), dr_url('pay/score'), 1);
         }
     }
     $this->template->assign(array('result_error' => $error));
     $this->template->display('pay_convert.html');
 }
Ejemplo n.º 14
0
 /**
  * 系统操作日志
  */
 public function oplog()
 {
     $time = isset($_POST['data']['time']) && $_POST['data']['time'] ? (int) $_POST['data']['time'] : (int) $this->input->get('time');
     $time = $time ? $time : SYS_TIME;
     $file = FCPATH . 'cache/optionlog/' . date('Ym', $time) . '/' . date('d', $time) . '.log';
     $list = array();
     $data = @explode(PHP_EOL, file_get_contents($file));
     $data = @array_reverse($data);
     $page = max(1, (int) $this->input->get('page'));
     $total = count($data);
     $limit = ($page - 1) * SITE_ADMIN_PAGESIZE;
     $i = $j = 0;
     foreach ($data as $v) {
         if ($v && $i >= $limit && $j < SITE_ADMIN_PAGESIZE) {
             $list[] = $v;
             $j++;
         }
         $i++;
     }
     $this->template->assign(array('time' => $time, 'list' => $list, 'total' => $total, 'pages' => $this->get_pagination(dr_url('system/oplog', array('time' => $time)), $total)));
     $this->template->display('system_oplog.html');
 }
Ejemplo n.º 15
0
 /**
  * 更新URL
  */
 public function url()
 {
     $cfile = SITE_ID . APP_DIR . $this->uid . $this->input->ip_address() . '_content_url';
     if (IS_POST) {
         $catid = $this->input->post('catid');
         $query = $this->link;
         if (count($catid) > 1 || $catid[0]) {
             $query->where_in('catid', $catid);
             if (count($this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category')) == count($catid)) {
                 $catid = 0;
             }
         } else {
             $catid = 0;
         }
         // 统计数量
         $total = $query->count_all_results($this->content_model->prefix . '_index');
         $this->cache->file->save($cfile, array('catid' => $catid, 'total' => $total), 10000);
         if ($total) {
             $this->mini_msg(dr_lang('132', $total), dr_url(APP_DIR . '/home/url', array('todo' => 1)), 2);
         } else {
             $this->mini_msg(lang('133'));
         }
     }
     // 处理url
     if ($this->input->get('todo')) {
         $page = max(1, (int) $this->input->get('page'));
         $psize = 100;
         // 每页处理的数量
         $cache = $this->cache->file->get($cfile);
         if ($cache) {
             $total = $cache['total'];
             $catid = $cache['catid'];
         } else {
             $catid = 0;
             $total = $this->link->count_all_results($this->content_model->prefix);
         }
         $tpage = ceil($total / $psize);
         // 总页数
         if ($page > $tpage) {
             // 更新完成删除缓存
             $this->cache->file->delete($cfile);
             $this->mini_msg(lang('360'), NULL, 1);
         }
         $module = $this->get_cache('module-' . SITE_ID . '-' . APP_DIR);
         $table = $this->content_model->prefix;
         if ($catid) {
             $this->link->where_in('catid', $catid);
         }
         $data = $this->link->limit($psize, $psize * ($page - 1))->order_by('id DESC')->get($table)->result_array();
         foreach ($data as $t) {
             $url = dr_show_url($module, $t);
             $this->link->update($table, array('url' => $url), 'id=' . $t['id']);
             if ($module['extend']) {
                 $extend = $this->link->where('cid', (int) $t['id'])->order_by('id DESC')->get($table . '_extend')->result_array();
                 if ($extend) {
                     foreach ($extend as $e) {
                         $this->link->where('id=', (int) $e['id'])->update($table . '_extend', array('url' => dr_extend_url($module, $e)));
                     }
                 }
             }
         }
         $this->mini_msg(dr_lang('135', "{$tpage}/{$page}"), dr_url(APP_DIR . '/home/url', array('todo' => 1, 'page' => $page + 1)), 2, 0);
     } else {
         $this->template->assign(array('menu' => $this->get_menu($this->_get_content_menu()), 'select' => $this->select_category($this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category'), 0, 'id="dr_synid" name=\'catid[]\' multiple style="width:200px;height:250px;"', '')));
         $this->template->display('content_url.html');
     }
 }
Ejemplo n.º 16
0
 /**
  * 修改
  */
 public function edit()
 {
     $id = (int) $this->input->get('id');
     $data = $this->db->where('id', $id)->limit(1)->get($this->space_content_model->tablename)->row_array();
     if (!$data) {
         $this->admin_msg(lang('019'));
     }
     $this->load->model('space_category_model');
     $this->load->model('space_content_model');
     $category = $this->space_category_model->get_data($this->mid, $data['uid']);
     if (IS_POST) {
         $post = $this->validate_filter($this->model['field']);
         $catid = (int) $this->input->post('catid');
         // 栏目参数
         // 验证出错信息
         if (isset($post['error'])) {
             $error = $post;
             $data = $this->input->post('data', TRUE);
         } elseif (!$catid) {
             $data = $this->input->post('data', TRUE);
             $error = array('error' => 'catid', 'msg' => lang('m-300'));
         } elseif ($category[$catid]['child'] || $category[$catid]['modelid'] != $this->mid) {
             $data = $this->input->post('data', TRUE);
             $error = array('error' => 'catid', 'msg' => lang('m-301'));
         } else {
             // 设定文档默认值
             $post[1]['catid'] = $catid;
             $post[1]['status'] = (int) $this->input->post('status');
             // 修改文档
             if (($id = $this->space_content_model->edit($id, $data['uid'], $post[1])) != FALSE) {
                 $mark = $this->space_content_model->tablename . '-' . $id;
                 if ($post[1]['status']) {
                     $member = $this->member_model->get_base_member($data['uid']);
                     $markrule = $member ? $member['mark'] : 0;
                     $experience = (int) $this->model['setting'][$markrule]['experience'];
                     $score = (int) $this->model['setting'][$markrule]['score'];
                     // 积分处理
                     if ($experience) {
                         $this->member_model->update_score(0, $data['uid'], $experience, $mark, "lang,m-151,{$category[$catid]['name']}", 1);
                     }
                     // 虚拟币处理
                     if ($score) {
                         $this->member_model->update_score(1, $data['uid'], $score, $mark, "lang,m-151,{$category[$catid]['name']}", 1);
                     }
                 }
                 $this->attachment_handle($data['uid'], $mark, $this->model['field'], $data, $post[1]['status'] ? TRUE : FALSE);
                 $this->member_msg(lang('000'), dr_url('member/content/index', array('mid' => $this->mid, 'tid' => $this->tid)), 1);
             }
         }
         $data = $data[1];
         unset($data['id']);
     }
     $this->template->assign(array('data' => $data, 'error' => $error, 'select' => $this->select_space_category($category, (int) $data['catid'], 'name=\'catid\'', NULL, 1), 'myfield' => $this->field_input($this->model['field'], $data)));
     $this->template->display('content_edit.html');
 }
Ejemplo n.º 17
0
 /**
  * 升级程序
  */
 public function upgrade()
 {
     $key = (int) $this->input->get('key');
     $dir = $this->input->get('dir');
     if (is_file(FCPATH . 'app/' . $dir . '/config/app.php')) {
         $config = (require FCPATH . 'app/' . $dir . '/config/app.php');
         if ((int) $config['key'] != $key) {
             $this->admin_msg('此应用无法在线升级,key不匹配');
         }
     } else {
         $this->admin_msg('此应用无法在线升级,目录(/app/' . $dir . '/)不存在');
     }
     $data = dr_catcher_data(urldecode($this->input->get('id')));
     if (!$data) {
         $this->admin_msg('对不起,您的服务器不支持远程下载');
     }
     $save = FCPATH . 'cache/down/app.zip';
     $check = FCPATH . 'cache/down/app/';
     if (!@file_put_contents($save, $data)) {
         $this->admin_msg('目录/cache/down/没有写入权限');
     }
     // 解压缩文件
     $this->load->helper('file');
     $this->load->library('Pclzip');
     // 文件安全性检测
     $this->pclzip->PclFile($save);
     $content = $this->pclzip->listContent();
     if (!$content) {
         $this->admin_msg('文件下载不完整或者已经损坏!<br>请检查网站目录权限或者联系应用开发者。');
     }
     foreach ($content as $t) {
         if (strpos($t['stored_filename'], '..') !== FALSE || strpos($t['stored_filename'], '/') === 0) {
             $this->admin_msg('含有非法名称的文件:' . basename($t['stored_filename']));
         }
     }
     unset($content);
     // 开始解压文件
     if ($this->pclzip->extract(PCLZIP_OPT_PATH, $check, PCLZIP_OPT_REPLACE_NEWER) == 0) {
         @unlink($save);
         delete_files(FCPATH . 'cache/down/', TRUE);
         $this->admin_msg("Error : " . $this->pclzip->errorInfo(true));
     }
     // 检查版本文件
     if (!is_file($check . 'config/app.php') || !filesize($check . 'config/app.php')) {
         delete_files(FCPATH . 'cache/down/', TRUE);
         $this->admin_msg('升级文件不完整,请重试');
     }
     // 覆盖至网站目录
     $this->pclzip->extract(PCLZIP_OPT_PATH, FCPATH . 'app/' . $dir, PCLZIP_OPT_REPLACE_NEWER);
     delete_files(FCPATH . 'cache/down/', TRUE);
     // 运行SQL语句
     if (is_file(FCPATH . 'app/' . $dir . '/update.sql')) {
         $sql = file_get_contents(FCPATH . 'app/' . $dir . '/update.sql');
         $sql = str_replace('{dbprefix}', $this->db->dbprefix, $sql);
         $this->sql_query($sql);
         @unlink(FCPATH . 'app/' . $dir . '/update.sql');
     }
     //检查update控制器
     if (is_file(FCPATH . 'app/' . $dir . '/controllers/admin/Update.php')) {
         $this->admin_msg('正在升级数据,请稍候...', dr_url($dir . '/update/index'), 2);
     }
     $this->admin_msg('升级完成,请重新检测一次版本', dr_url('application/index'), 1);
 }
Ejemplo n.º 18
0
 /**
  * 日志
  */
 public function log()
 {
     if (IS_POST) {
         @unlink(FCPATH . 'cache/mail_error.log');
         exit(dr_json(1, lang('000')));
     }
     $data = $list = array();
     $file = @file_get_contents(FCPATH . 'cache/mail_error.log');
     if ($file) {
         $data = explode(PHP_EOL, $file);
         $data = $data ? array_reverse($data) : array();
         unset($data[0]);
         $page = max(1, (int) $this->input->get('page'));
         $limit = ($page - 1) * SITE_ADMIN_PAGESIZE;
         $i = $j = 0;
         foreach ($data as $v) {
             if ($i >= $limit && $j < SITE_ADMIN_PAGESIZE) {
                 $list[] = $v;
                 $j++;
             }
             $i++;
         }
     }
     $total = count($data);
     $this->template->assign(array('list' => $list, 'total' => $total, 'pages' => $this->get_pagination(dr_url('mail/log'), $total)));
     $this->template->display('mail_log.html');
 }
Ejemplo n.º 19
0
 /**
  * 显示
  */
 public function show()
 {
     if ($this->is_auth('admin/navigator/edit')) {
         $id = (int) $this->input->get('id');
         $data = $this->db->select('show,type')->where('id', $id)->limit(1)->get(SITE_ID . '_navigator')->row_array();
         $this->db->where('id', $id)->update(SITE_ID . '_navigator', array('show' => $data['show'] == 1 ? 0 : 1));
         $this->cache(1);
         $this->admin_msg(lang('000'), dr_url('navigator/index', array('type' => $data['type'])), 1);
     } else {
         $this->admin_msg(lang('160'));
     }
 }
/**
 * 会员url函数
 *
 * @param	string	$url 	URL规则,如home/index
 * @param	array	$query	相关参数
 * @return	string	地址
 */
function dr_member_url($url, $query = array())
{
    return MEMBER_URL . dr_url($url, $query, 'index.php');
}
Ejemplo n.º 21
0
 /**
  * 注册
  */
 public function index()
 {
     $MEMBER = $this->get_cache('MEMBER');
     // 判断是否开启注册
     if (!$MEMBER['setting']['register']) {
         $this->member_msg(lang('m-016'));
     }
     // 已经登录不允许注册
     if ($this->member) {
         $this->member_msg(lang('m-017'));
     }
     if (IS_POST) {
         $data = $this->input->post('data', TRUE);
         $back_url = $_POST['back'] ? urldecode($this->input->post('back')) : '';
         if ($MEMBER['setting']['regcode'] && !$this->check_captcha('code')) {
             $error = array('name' => 'code', 'msg' => lang('m-000'));
         } elseif (!$data['password']) {
             $error = array('name' => 'password', 'msg' => lang('m-018'));
         } elseif ($data['password'] !== $data['password2']) {
             $error = array('name' => 'password2', 'msg' => lang('m-019'));
         } elseif ($result = $this->is_username($data['username'])) {
             $error = array('name' => 'username', 'msg' => $result);
         } elseif ($result = $this->is_email($data['email'])) {
             $error = array('name' => 'email', 'msg' => $result);
         } else {
             $this->hooks->call_hook('member_register_before', $data);
             // 注册之前挂钩点
             $id = $this->member_model->register($data);
             if ($id > 0) {
                 // 注册成功
                 $this->hooks->call_hook('member_register_after', $data);
                 // 注册之后挂钩点
                 $this->member_msg(lang('m-020'), $back_url && strpos($back_url, 'register') === FALSE ? $back_url : dr_url('login/index'), 1);
             } elseif ($id == -1) {
                 $error = array('name' => 'username', 'msg' => dr_lang('m-021', $data['username']));
             } elseif ($id == -2) {
                 $error = array('name' => 'email', 'msg' => lang('m-011'));
             } elseif ($id == -3) {
                 $error = array('name' => 'email', 'msg' => dr_lang('m-022', $data['email']));
             } elseif ($id == -4) {
                 $error = array('name' => 'username', 'msg' => lang('m-023'));
             } elseif ($id == -5) {
                 $error = array('name' => 'username', 'msg' => lang('m-024'));
             } elseif ($id == -6) {
                 $error = array('name' => 'username', 'msg' => lang('m-025'));
             } elseif ($id == -7) {
                 $error = array('name' => 'username', 'msg' => lang('m-026'));
             } elseif ($id == -8) {
                 $error = array('name' => 'username', 'msg' => lang('m-027'));
             } elseif ($id == -9) {
                 $error = array('name' => 'username', 'msg' => lang('m-028'));
             }
         }
     } else {
         $data = array();
         $error = '';
         $back_url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
     }
     $this->template->assign(array('data' => $data, 'code' => $MEMBER['setting']['regcode'], 'back_url' => $back_url, 'meta_name' => lang('m-029'), 'result_error' => $error));
     $this->template->display('register.html');
 }
 /**
  * 修改审核
  */
 public function edit()
 {
     $id = (int) $this->input->get('id');
     $data = $this->content_model->get_extend_verify($id);
     $error = array();
     if (!$data) {
         $this->member_msg(lang('019'));
     }
     // 禁止修改他人文档
     if ($data['author'] != $this->member['username'] && $data['uid'] != $this->member['uid']) {
         $this->member_msg(lang('mod-05'));
     }
     $field = $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'extend');
     if (IS_POST) {
         $_data = $data;
         // 设置uid便于校验处理
         $_POST['data']['id'] = $id;
         $_POST['data']['uid'] = $this->uid;
         $_POST['data']['author'] = $this->member['username'];
         $data = $this->validate_filter($field, $_data);
         if (isset($data['error'])) {
             $error = $data;
             $data = $this->input->post('data', TRUE);
         } else {
             $this->content = $this->content_model->get($_data['cid']);
             $data[1]['cid'] = (int) $this->content['id'];
             $data[1]['uid'] = $this->member['uid'];
             $data[1]['catid'] = (int) $this->content['catid'];
             $data[1]['status'] = 1;
             $data[1]['author'] = $this->member['username'];
             if (isset($data[1]['mytype'])) {
                 $data[1]['mytype'] = $_data['mytype'];
             }
             // 修改数据
             if ($this->content_model->edit_extend($_data, $data)) {
                 $this->attachment_handle($this->uid, $this->content_model->prefix . '_verify-' . $_data['cid'] . '-' . $id, $field);
                 if (IS_AJAX) {
                     exit(dr_json(1, lang('m-341'), dr_member_url(APP_DIR . '/everify/index')));
                 }
                 $this->template->assign(array('url' => dr_member_url(APP_DIR . '/everify/index'), 'add' => dr_member_url(APP_DIR . '/extend/add', array('cid' => $_data['cid'])), 'edit' => 1, 'list' => dr_member_url(APP_DIR . '/extend/index', array('cid' => $_data['cid'])), 'meta_name' => lang('mod-03')));
                 $this->template->display('verify.html');
             } else {
                 $this->member_msg(lang('mod-06'));
             }
             exit;
         }
     }
     $backurl = str_replace(MEMBER_URL, '', $_SERVER['HTTP_REFERER']);
     $this->template->assign(array('purl' => dr_url(APP_DIR . '/everify/edit', array('id' => $id)), 'data' => $data, 'myfield' => $this->field_input($field, $data, TRUE), 'backurl' => $backurl ? $backurl : dr_url(APP_DIR . '/everify/index'), 'listurl' => $backurl ? $backurl : dr_url(APP_DIR . '/everify/index'), 'meta_name' => lang('mod-41'), 'result_error' => $error));
     $this->template->display('everify_edit.html');
 }
 /**
  * 修改
  */
 public function edit()
 {
     // 作者判断
     if ($this->content['uid'] != $this->uid) {
         $this->member_msg(lang('mod-05'));
     }
     // 修改权限
     if (!$this->catrule['edit']) {
         $this->member_msg(lang('160'));
     }
     $id = (int) $this->input->get('id');
     $did = (int) $this->input->get('did');
     $data = $this->content_model->get_extend($id);
     if (!$data) {
         $this->member_msg(lang('019'));
     }
     $error = array();
     $result = '';
     if (IS_POST) {
         $_data = $data;
         $type = (int) $this->input->post('type');
         $_POST['data']['cid'] = $this->content['id'];
         $_POST['data']['uid'] = $this->content['uid'];
         $data = $this->validate_filter($this->field, $_data);
         if (isset($data['error'])) {
             $error = $data;
             $data = $this->input->post('data', TRUE);
         } else {
             $status = isset($data['status']) && $data['status'] ? 9 : ($this->module_rule[$this->content['catid']]['verify'] ? 1 : 9);
             $status = isset($this->module_rule[$this->content['catid']]['edit_verify']) && $this->module_rule[$this->content['catid']]['edit_verify'] ? 9 : $status;
             $data[1]['cid'] = $this->content['id'];
             $data[1]['uid'] = $_data['uid'];
             $data[1]['catid'] = $this->content['catid'];
             $data[1]['status'] = $status;
             $data[1]['author'] = $_data['author'];
             $data[1]['updatetime'] = SYS_TIME;
             // 保存为草稿
             if ($this->input->post('action') == 'draft') {
                 $data[1]['id'] = $data[0]['id'] = $id;
                 $id = $this->content_model->save_draft($did, $data, 1);
                 $this->attachment_handle($this->uid, $this->content_model->prefix . '_draft-' . $id, $this->field);
                 $this->admin_msg(lang('m-229'), dr_url(APP_DIR . '/home/draft/'), 1);
                 exit;
             }
             // 正常保存
             if ($id = $this->content_model->edit_extend($_data, $data)) {
                 // 发布草稿时删除草稿数据
                 if ($did && $this->content_model->delete_draft($did, 'cid=' . $this->content['id'] . ' and eid=' . $id)) {
                     $this->attachment_replace_draft($did, $this->content['id'], $id, $this->content_model->prefix, $data[1]['status']);
                 }
                 if ($data[1]['status'] == 9) {
                     $mark = $this->content_model->prefix . '-' . $this->content['id'] . '-' . $id;
                     // 操作成功处理附件
                     $this->attachment_handle($this->content['uid'], $mark, $this->field, $_data);
                     if (IS_AJAX) {
                         exit(dr_json(1, lang('m-340'), dr_member_url(APP_DIR . '/extend/index', array('cid' => $this->content['id']))));
                     }
                     $this->template->assign(array('url' => SITE_URL . APP_DIR . '/index.php?c=extend&id=' . $id, 'add' => dr_member_url(APP_DIR . '/extend/add', array('cid' => $this->content['id'], 'type' => $data[1]['mytype'])), 'edit' => 1, 'html' => MODULE_HTML ? dr_module_create_show_file($this->content['id']) . dr_module_create_list_file($this->content['catid']) : '', 'list' => dr_member_url(APP_DIR . '/extend/index', array('cid' => $this->content['id'])), 'meta_name' => lang('mod-19')));
                     $this->template->display('success.html');
                 } else {
                     $this->attachment_handle($this->uid, $this->content_model->prefix . '_verify-' . $this->content['id'] . '-' . $id, $this->field);
                     if (IS_AJAX) {
                         exit(dr_json(1, lang('m-341'), dr_member_url(APP_DIR . '/everify/index')));
                     }
                     $this->template->assign(array('url' => dr_member_url(APP_DIR . '/everify/index'), 'add' => dr_member_url(APP_DIR . '/extend/add', array('cid' => $this->content['id'], 'type' => $data[1]['mytype'])), 'edit' => 0, 'list' => dr_member_url(APP_DIR . '/extend/index', array('cid' => $this->content['id'])), 'meta_name' => lang('mod-19')));
                     $this->template->display('verify.html');
                 }
                 exit;
             } else {
                 $error = array('error' => $id);
             }
         }
     } else {
         if ($did) {
             $temp = $this->content_model->get_draft($did);
             if ($temp['draft']['cid'] == $this->content['id'] && $temp['draft']['eid'] == $id) {
                 $data = $temp;
             }
         }
     }
     $this->template->assign(array('did' => $did, 'data' => $data, 'error' => $error, 'result' => $result, 'myfield' => $this->field_input($this->field, $data, TRUE), 'draft_url' => MEMBER_URL . dr_url(APP_DIR . '/extend/edit', array('cid' => $this->content['id'], 'catid' => $this->catid, 'id' => $id)), 'draft_list' => $this->content_model->get_draft_list('cid=' . $this->content['id'] . ' and eid=' . $id), 'result_error' => $error));
     $this->template->display('content_extend_add.html');
 }
Ejemplo n.º 24
0
 /**
  * 空间配置
  */
 public function space()
 {
     $data = $this->member_model->space();
     $page = (int) $this->input->get('page');
     if (IS_POST) {
         $post = $this->input->post('data');
         $page = (int) $this->input->post('page');
         $this->member_model->space($post);
         $this->member_model->cache();
         $this->system_log('会员空间配置');
         // 记录日志
         if ($post['open'] != $data['open']) {
             $this->admin_msg(lang('339'), '', 1);
         } else {
             $this->admin_msg(lang('000'), dr_url('member/setting/space', array('page' => $page)), 1);
         }
     }
     $this->template->assign(array('menu' => $this->get_menu(array(lang('html-521') => 'member/admin/setting/space')), 'page' => $page, 'data' => $data));
     $this->template->display('setting_space.html');
 }
Ejemplo n.º 25
0
 /**
  * 未使用的附件
  */
 public function unused()
 {
     if ($this->input->post('ids')) {
         $ids = $this->input->post('ids');
         // 删除未使用
         $data = $this->db->where_in('id', $ids)->get($this->db->dbprefix('attachment_unused'))->result_array();
         if ($data) {
             // 删除附件
             foreach ($data as $t) {
                 $this->db->delete($this->db->dbprefix('attachment'), 'id=' . $t['id']);
                 $this->db->delete($this->db->dbprefix('attachment_unused'), 'id=' . $t['id']);
                 $this->attachment_model->_delete_attachment($t);
             }
         }
         exit(dr_json(1, lang('000')));
     }
     $page = max((int) $this->input->get('page'), 1);
     $where = '`siteid`=' . SITE_ID;
     $total = (int) $this->input->get('total');
     $param = array();
     if ($this->input->post('author')) {
         $param['author'] = $this->input->post('author', TRUE);
         $where .= ' AND `author`="' . $param['author'] . '"';
         $total = 0;
     } elseif ($this->input->get('author')) {
         $param['author'] = $this->input->get('author', TRUE);
         $where .= ' AND `author`="' . $param['author'] . '"';
     }
     $param['total'] = $total ? $total : $this->db->where($where)->count_all_results($this->db->dbprefix('attachment_unused'));
     $data = $this->db->where($where)->order_by('inputtime DESC')->limit(SITE_ADMIN_PAGESIZE, SITE_ADMIN_PAGESIZE * ($page - 1))->get($this->db->dbprefix('attachment_unused'))->result_array();
     $this->template->assign(array('list' => $data, 'param' => $param, 'pages' => $this->get_pagination(dr_url(APP_DIR . '/attachment/unused', $param), $param['total'])));
     $this->template->display('attachment_unused.html');
 }
Ejemplo n.º 26
0
 /**
  * 修改内容
  */
 protected function _editc()
 {
     if (!$this->is_auth('admin/form/listc')) {
         if (IS_AJAX) {
             exit('<img src=' . SITE_URL . 'member/statics/js/skins/icons/error.png>' . dr_lang('049', 'admin/form/listc'));
         } else {
             $this->admin_msg(dr_lang('049', 'admin/form/listc'));
         }
     }
     $id = (int) $this->input->get('id');
     $table = $this->form_model->prefix . '_' . $this->form['table'];
     // 获取表单数据
     $data = $this->form_model->get_data($id, $table);
     if (!$data) {
         $this->admin_msg(lang('019'));
     }
     if (IS_POST) {
         $post = $this->validate_filter($this->form['field'] + $this->field);
         // 验证出错信息
         if (isset($post['error'])) {
             $error = $post;
             $data = $this->input->post('data', TRUE);
         } else {
             // 发布文档
             if ($this->form_model->new_editc($id, $this->form['table'], $data['tableid'], $post)) {
                 // 附件归档到文档
                 $this->attachment_handle($this->uid, $table . '-' . $id, $this->form['field']);
                 $this->system_log('修改站点【#' . SITE_ID . '】表单【' . $this->form['table'] . '】内容【#' . $id . '】');
                 // 记录日志
                 $this->member_msg(lang('000'), dr_url($this->router->class . '/index'), 1);
             }
         }
         if ($post[0]) {
             $data = array_merge($post[1], $post[0]);
         } else {
             $data = $post[1];
         }
         unset($data['id']);
     }
     $tpl = APPPATH . 'templates/admin/form_addc_' . $this->form['table'] . '.html';
     $this->template->assign(array('tpl' => str_replace(FCPATH, '/', $tpl), 'menu' => $this->get_menu(array(lang('245') => 'admin/form/index', $this->form['name'] => $this->uriprefix . 'index', lang('add') => $this->uriprefix . 'add', lang('edit') => $this->uriprefix . 'edit/id/' . $id)), 'data' => $data, 'error' => $error, 'myfield' => $this->field_input($this->form['field'] + $this->field, $data)));
     $this->template->display(is_file($tpl) ? basename($tpl) : 'form_addc.html');
 }
 public function replace()
 {
     $cfile = SITE_ID . APP_DIR . $this->uid . $this->input->ip_address() . '_content_replace';
     if (IS_POST) {
         $bm = $this->input->post('bm');
         $t1 = $this->input->post('t1');
         $t2 = $this->input->post('t2');
         $fd = $this->input->post('fd');
         if (!$fd || !$t1) {
             $this->mini_msg('“待替换字段”和“被替换内容”必须填写!');
         }
         if ($fd == 'id') {
             $this->mini_msg('主键不支持替换!');
         }
         // 表名判断
         $field = $this->get_table_field(str_replace('{id}', '0', $bm));
         if (!$field) {
             $this->mini_msg('此表【' . str_replace('{id}', '0', $bm) . '】无可用字段');
         }
         // 可用字段判断
         if (!isset($field[$fd])) {
             $this->mini_msg('在表【' . str_replace('{id}', '0', $bm) . '】中没有找到字段【' . $fd . '】');
         }
         $this->cache->file->save($cfile, array('bm' => $bm, 't1' => $t1, 't2' => $t2, 'fd' => $fd), 10000);
         $this->system_log('站点【#' . SITE_ID . '】模块【' . APP_DIR . '】替换内容操作');
         // 记录日志
         $this->mini_msg('正在搜索替换...', dr_url(APP_DIR . '/home/replace', array('todo' => 1)), 2);
     }
     // 处理url
     if ($this->input->get('todo')) {
         $cache = $this->cache->file->get($cfile);
         if (!$cache['fd'] || !$cache['t1']) {
             $this->cache->file->delete($cfile);
             $this->mini_msg('缓存失败:“待替换字段”和“被替换内容”必须填写!');
         }
         $count = 0;
         $replace = '`' . $cache['fd'] . '`=REPLACE(`' . $cache['fd'] . '`, \'' . addslashes($cache['t1']) . '\', \'' . addslashes($cache['t2']) . '\')';
         if (strpos($cache['bm'], '{id}')) {
             for ($i = 0; $i < 100; $i++) {
                 $table = str_replace('{id}', $i, $cache['bm']);
                 if (!$this->link->query("SHOW TABLES LIKE '" . $table . "'")->row_array()) {
                     break;
                 }
                 $this->link->query('UPDATE `' . $table . '` SET ' . $replace);
                 $count += $this->link->affected_rows();
             }
         } else {
             $this->link->query('UPDATE `' . $cache['bm'] . '` SET ' . $replace);
             $count = $this->link->affected_rows();
         }
         $this->cache->file->delete($cfile);
         $this->mini_msg('替换完毕,共替换' . $count . '条数据', NULL, 1);
     } else {
         $bm = array(array('name' => '主表', 'table' => $this->content_model->prefix), array('name' => '附表', 'table' => $this->content_model->prefix . '_data_{id}'), array('name' => '栏目主表', 'table' => $this->content_model->prefix . '_category_data'), array('name' => '栏目附表', 'table' => $this->content_model->prefix . '_category_data_{id}'));
         if ($this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'extend')) {
             $bm[] = array('name' => '扩展主表', 'table' => $this->content_model->prefix . '_extend');
             $bm[] = array('name' => '扩展附表', 'table' => $this->content_model->prefix . '_extend_data_{id}');
         }
         $form = $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'form');
         if ($form) {
             foreach ($form as $t) {
                 $bm[] = array('name' => $t['name'] . '主表', 'table' => $this->content_model->prefix . '_form_' . $t['table']);
                 $bm[] = array('name' => $t['name'] . '附表', 'table' => $this->content_model->prefix . '_form_' . $t['table'] . '_data_{id}');
             }
         }
         $this->template->assign(array('bm' => $bm, 'menu' => $this->get_menu($this->_get_content_menu())));
         $this->template->display('content_replace.html');
     }
 }
Ejemplo n.º 28
0
 /**
  * 安装程序
  */
 public function index()
 {
     $step = max(1, (int) $this->input->get('step'));
     switch ($step) {
         case 1:
             break;
         case 2:
             $check_pass = true;
             $writeAble = $this->_checkFileRight();
             $lowestEnvironment = $this->_getLowestEnvironment();
             $currentEnvironment = $this->_getCurrentEnvironment();
             $recommendEnvironment = $this->_getRecommendEnvironment();
             foreach ($currentEnvironment as $key => $value) {
                 if (false !== strpos($key, '_ischeck') && false === $value) {
                     $check_pass = false;
                 }
             }
             foreach ($writeAble as $value) {
                 if (false === $value) {
                     $check_pass = false;
                 }
             }
             $this->template->assign(array('writeAble' => $writeAble, 'check_pass' => $check_pass, 'lowestEnvironment' => $lowestEnvironment, 'currentEnvironment' => $currentEnvironment, 'recommendEnvironment' => $recommendEnvironment));
             break;
         case 3:
             if ($_POST) {
                 $data = $this->input->post('data');
                 $data['dbhost'] = str_replace('localhost', '127.0.0.1', $data['dbhost']);
                 // 参数判断
                 if (!preg_match('/^[\\x7f-\\xff\\dA-Za-z\\.\\_]+$/', $data['admin'])) {
                     exit(dr_json(0, '管理员账号格式不正确'));
                 }
                 if (!$data['password']) {
                     exit(dr_json(0, '管理员密码不能为空'));
                 }
                 if (!$data['dbname']) {
                     exit(dr_json(0, '数据库名称不能为空'));
                 }
                 $this->load->helper('email');
                 if (!$data['email'] || !valid_email($data['email'])) {
                     exit(dr_json(0, 'Email格式不正确'));
                 }
                 if (!@mysql_connect($data['dbhost'], $data['dbuser'], $data['dbpw'])) {
                     exit(dr_json(0, '无法连接到数据库服务器,请检查用户名(' . $data['dbuser'] . ')和密码(' . $data['dbpw'] . ')是否正确'));
                 }
                 if (!@mysql_select_db($data['dbname'])) {
                     if (!@mysql_query('CREATE DATABASE ' . $data['dbname'])) {
                         exit(dr_json(0, '指定的数据库(' . $data['dbname'] . ')不存在,系统尝试创建失败,请通过其他方式建立数据库'));
                     }
                 }
                 // utf8方式打开数据库
                 mysql_query('SET NAMES utf8');
                 // 格式化端口
                 list($data['dbhost'], $data['dbport']) = explode(':', $data['dbhost']);
                 $data['dbport'] = $data['dbport'] ? (int) $data['dbport'] : 3306;
                 $data['dbprefix'] = $data['dbprefix'] ? $data['dbprefix'] : 'dr_';
                 // 配置文件
                 $config = "<?php" . PHP_EOL . PHP_EOL;
                 $config .= "if (!defined('BASEPATH')) exit('No direct script access allowed');" . PHP_EOL . PHP_EOL;
                 $config .= "\$active_group\t= 'default';" . PHP_EOL;
                 $config .= "\$query_builder\t= TRUE;" . PHP_EOL . PHP_EOL;
                 $config .= "\$db['default']\t= array(" . PHP_EOL;
                 $config .= "\t'dsn'\t\t=> ''," . PHP_EOL;
                 $config .= "\t'hostname'\t=> '{$data['dbhost']}'," . PHP_EOL;
                 $config .= "\t'username'\t=> '{$data['dbuser']}'," . PHP_EOL;
                 $config .= "\t'password'\t=> '{$data['dbpw']}'," . PHP_EOL;
                 $config .= "\t'port'\t\t=> '{$data['dbport']}'," . PHP_EOL;
                 $config .= "\t'database'\t=> '{$data['dbname']}'," . PHP_EOL;
                 $config .= "\t'dbdriver'\t=> 'mysql'," . PHP_EOL;
                 $config .= "\t'dbprefix'\t=> '{$data['dbprefix']}'," . PHP_EOL;
                 $config .= "\t'pconnect'\t=> FALSE," . PHP_EOL;
                 $config .= "\t'db_debug'\t=> TRUE," . PHP_EOL;
                 $config .= "\t'cache_on'\t=> FALSE," . PHP_EOL;
                 $config .= "\t'cachedir'\t=> 'cache/sql/'," . PHP_EOL;
                 $config .= "\t'char_set'\t=> 'utf8'," . PHP_EOL;
                 $config .= "\t'dbcollat'\t=> 'utf8_general_ci'," . PHP_EOL;
                 $config .= "\t'swap_pre'\t=> ''," . PHP_EOL;
                 $config .= "\t'autoinit'\t=> FALSE," . PHP_EOL;
                 $config .= "\t'encrypt'\t=> FALSE," . PHP_EOL;
                 $config .= "\t'compress'\t=> FALSE," . PHP_EOL;
                 $config .= "\t'stricton'\t=> FALSE," . PHP_EOL;
                 $config .= "\t'failover'\t=> array()," . PHP_EOL;
                 $config .= ");" . PHP_EOL;
                 // 保存配置文件
                 if (!file_put_contents(FCPATH . 'config/database.php', $config)) {
                     exit(dr_json(0, '数据库配置文件保存失败,请检查文件config/database.php权限!'));
                 }
                 // 加载数据库
                 $this->load->database();
                 $salt = substr(md5(rand(0, 999)), 0, 10);
                 $password = md5(md5($data['password']) . $salt . md5($data['password']));
                 // 导入表结构
                 $this->_query(str_replace(array('{dbprefix}', '{username}', '{password}', '{salt}', '{email}'), array($this->db->dbprefix, $data['admin'], $password, $salt, $data['email']), file_get_contents(FCPATH . 'cache/install/install.sql')));
                 // 导入后台菜单数据
                 $this->_query(str_replace('{dbprefix}', $this->db->dbprefix, file_get_contents(FCPATH . 'cache/install/admin_menu.sql')));
                 // 导入会员菜单数据
                 $this->_query(str_replace('{dbprefix}', $this->db->dbprefix, file_get_contents(FCPATH . 'cache/install/member_menu.sql')));
                 // 系统配置文件
                 $this->load->model('system_model');
                 $config = array('SYS_LOG' => 'FALSE', 'SYS_KEY' => 'OmWeb', 'SYS_DEBUG' => 'FALSE', 'SYS_HELP_URL' => 'http://www.omooo.com/help/list-341.html', 'SYS_EMAIL' => $data['email'], 'SYS_MEMCACHE' => 'FALSE', 'SYS_CRON_QUEUE' => 0, 'SYS_CRON_NUMS' => 20, 'SYS_CRON_TIME' => 300, 'SITE_EXPERIENCE' => '经验值', 'SITE_SCORE' => '虚拟币', 'SITE_MONEY' => '金钱', 'SITE_CONVERT' => 10, 'SITE_ADMIN_CODE' => 'FALSE', 'SITE_ADMIN_PAGESIZE' => 8);
                 $this->system_model->save_config($config, $config);
                 // 站点配置文件
                 $this->load->model('site_model');
                 $this->load->library('dconfig');
                 $config = (require FCPATH . 'config/site/1.php');
                 $config['SITE_DOMAIN'] = $config['SITE_ATTACH_HOST'] = $config['SITE_ATTACH_URL'] = strtolower($_SERVER['HTTP_HOST']);
                 $site = array('name' => 'OmWeb', 'domain' => strtolower($_SERVER['HTTP_HOST']), 'setting' => $config);
                 $this->site_model->add_site($site);
                 $this->dconfig->file(FCPATH . 'config/site/1.php')->note('站点配置文件')->space(32)->to_require_one($this->site_model->config, $config);
                 // 导入默认数据
                 $this->_query(str_replace(array('{dbprefix}', '{site_url}'), array($this->db->dbprefix, 'http://' . strtolower($_SERVER['HTTP_HOST'])), file_get_contents(FCPATH . 'cache/install/default.sql')));
                 exit(dr_json(1, dr_url('install/index', array('step' => $step + 1))));
             }
             break;
         case 4:
             $log = array();
             $sql = file_get_contents(FCPATH . 'cache/install/install.sql');
             preg_match_all('/`\\{dbprefix\\}(.+)`/U', $sql, $match);
             if ($match) {
                 $log = array_unique($match[1]);
             }
             $this->template->assign(array('log' => implode('<OmWeb>', $log)));
             break;
         case 5:
             file_put_contents(FCPATH . 'cache/install.lock', time());
             break;
     }
     $this->template->assign(array('step' => $step));
     $this->template->display('install_' . $step . '.html', 'admin');
 }
	width:120px;
	text-align:right;
}

</style>
<link rel="stylesheet" href="<?php 
echo SITE_PATH;
?>
omooo/statics/css/font-awesome/css/font-awesome.css" />
<div id="main_frameid" class="pad-10" style="_margin-right:-12px;_width:98.9%;">
	<script type="text/javascript">
    $(function(){
   	 $.getScript("http://www.omooo.com/shouquan.php?c=sys&m=omooo_news");

        $.getScript("<?php 
echo dr_url('home/mtotal');
?>
");
        $.getScript("http://www.omooo.com/shouquan.php?c=sys&m=license&domain=<?php 
echo SITE_URL;
?>
&admin=<?php 
echo SELF;
?>
&version=<?php 
echo DR_VERSION_ID;
?>
");
         if ($.browser.msie && parseInt($.browser.version) < 8) $('#browserVersionAlert').show();
        if (screen.width <= 900) $('#screenAlert').show();
		<?php 
                    title: '<?php 
echo lang("html-469");
?>
',
                    cancel: function() {
                        dr_login = 1;
                    },
                    ok: function() {
                        // 标示可以提交表单
                        win.$("#mark").val("0");
                        // 按钮返回验证表单函数
                        if (win.dr_form_check()) {
                            var _data = win.$("#myform").serialize();
                            // 将表单数据ajax提交验证
                            $.ajax({type: "POST",dataType:"json", url: '<?php 
echo dr_url("login/ajax");
?>
' , data: _data,
                                success: function(data) {
                                    //验证成功
                                    if (data.status == 1) {
                                        $.dialog.tips('<?php 
echo lang("m-002");
?>
', 2, 1);
                                    } else {
                                        //验证失败
                                        $.dialog.tips(data.code);
                                    }
                                },
                                error: function(HttpRequest, ajaxOptions, thrownError) {