/**
  * 提醒查看
  */
 private function m_notice($type)
 {
     $name = array(1 => lang('m-356'), 2 => lang('m-357'), 3 => lang('m-358'), 4 => lang('m-359'));
     $this->db->where('uid', (int) $this->uid)->where('type', (int) $type)->order_by('inputtime DESC');
     if (IS_POST) {
         $this->db->where_in('id', $this->input->post('ids'))->delete('member_notice_' . $this->member['tableid']);
         exit(dr_json(1, lang('000')));
     }
     if ($this->input->get('action') == 'more') {
         // ajax更多数据
         $page = max((int) $this->input->get('page'), 1);
         $data = $this->db->limit($this->pagesize, $this->pagesize * ($page - 1))->get('member_notice_' . $this->member['tableid'])->result_array();
         if (!$data) {
             exit('null');
         }
         $this->template->assign('list', $data);
         $this->template->display('notice_data.html');
     } else {
         $url = 'index.php?c=' . $this->router->class . '&m=' . $this->router->method . '&action=more';
         $this->template->assign(array('list' => $this->db->limit($this->pagesize)->get('member_notice_' . $this->member['tableid'])->result_array(), 'moreurl' => $url, 'searchurl' => $url, 'meta_name' => $name[$type]));
         // 更新新提醒
         $this->db->where('uid', (int) $this->uid)->where('type', (int) $type)->update('member_notice_' . $this->member['tableid'], array('isnew' => 0));
         // 删除新提醒
         $this->db->where('uid', (int) $this->uid)->delete('member_new_notice');
         $this->template->display('notice_index.html');
     }
 }
 public function ajax()
 {
     $data = $this->input->post('data', TRUE);
     $uid = $this->member_model->admin_login($data['username'], $data['password']);
     if ($uid > 0) {
         set_cookie('finecms-admin-login', $data['username'], 999999);
         exit(dr_json(1, 1, 1));
     }
     if ($uid == -1) {
         $error = lang('043');
         exit(dr_json(0, $error, 'username'));
     } elseif ($uid == -2) {
         $error = lang('044');
         exit(dr_json(0, $error, 'password'));
     } elseif ($uid == -3) {
         $error = lang('045');
         exit(dr_json(0, $error, 'username'));
     } elseif ($uid == -4) {
         $error = lang('046');
         exit(dr_json(0, $error, 'username'));
     } else {
         $error = lang('047');
         exit(dr_json(0, $error, 'username'));
     }
 }
Beispiel #3
0
 /**
  * 话题管理
  */
 public function topic()
 {
     if (IS_POST && $this->input->post('action')) {
         // ID格式判断
         $ids = $this->input->post('ids', TRUE);
         if (!$ids) {
             exit(dr_json(0, lang('013')));
         }
         // 删除
         if (!$this->is_auth('member/admin/sns/del')) {
             exit(dr_json(0, lang('160')));
         }
         foreach ($ids as $id) {
             $this->sns_model->delete_topic($id);
         }
         exit(dr_json(1, lang('000')));
     }
     // 重置页数和统计
     if (IS_POST) {
         $_GET['page'] = $_GET['total'] = 0;
     }
     // 根据参数筛选结果
     $param = array();
     if ($this->input->get('search')) {
         $param['search'] = 1;
     }
     // 数据库中分页查询
     list($data, $_param, $_search) = $this->sns_model->topic_limit_page($param, max((int) $_GET['page'], 1), (int) $_GET['total']);
     $param = $_param ? $param + $_param : $param;
     $field = array('username' => array('fieldname' => 'username', 'name' => lang('html-766')), 'name' => array('fieldname' => 'name', 'name' => lang('html-764'))) + ($field ? $field : array());
     $search = $_search ? $param + $_search : $param;
     $this->template->assign(array('list' => $data, 'field' => $field, 'param' => $search, 'pages' => $this->get_pagination(dr_url('member/topic/index', $param), $param['total'])));
     $this->template->display('sns_topic.html');
 }
 /**
  * 消息管理
  */
 public function index()
 {
     if (IS_POST) {
         if ($this->input->post('action') == 'read') {
             $this->pm_model->set_read($this->uid, $this->input->post('ids'));
             exit(dr_json(1, lang('000')));
         } else {
             $this->pm_model->deletes($this->uid, $this->input->post('ids'));
             exit(dr_json(1, lang('000')));
         }
     }
     if ($this->input->get('action') == 'more') {
         // ajax更多数据
         list($touid, $list) = $this->pm_model->limit_page($this->uid, max(1, (int) $this->input->get('page')));
         if (!$list) {
             exit('null');
         }
         $this->template->assign(array('list' => $list));
         $this->template->display('pm_data.html');
         exit;
     }
     $list = $this->pm_model->limit_page($this->uid, max(1, (int) $this->input->get('page')));
     $this->template->assign(array('list' => $list, 'searchurl' => 'index.php?c=' . $this->router->class . '&m=' . $this->router->method . '&action=more', 'meta_name' => lang('m-009')));
     $this->template->display('pm_index.html');
 }
 /**
  * 管理
  */
 public function index()
 {
     if (IS_POST) {
         $ids = $this->input->post('ids', TRUE);
         if (!$ids) {
             exit(dr_json(0, lang('013')));
         }
         if (!$this->is_auth('admin/poster2/del')) {
             exit(dr_json(0, lang('160')));
         }
         $this->poster_model->delete('id IN(' . @implode(',', $ids) . ')');
         $this->system_log('删除广告【#' . @implode(',', $ids) . '】');
         // 记录日志
         exit(dr_json(1, lang('000')));
     }
     $data = array();
     $page = max(1, (int) $_GET['page']);
     $total = $_GET['total'] ? $_GET['total'] : $this->link->where('sid', $this->sid)->count_all_results($this->table);
     $order = isset($_GET['order']) && strpos($_GET['order'], "undefined") !== 0 ? $_GET['order'] : 'id DESC';
     if ($total) {
         $data = $this->link->where('sid', $this->sid)->order_by($order)->limit(SITE_ADMIN_PAGESIZE, SITE_ADMIN_PAGESIZE * ($page - 1))->get($this->table)->result_array();
     }
     $param = array('sid' => $this->sid, 'total' => $total, 'order' => $order);
     $this->template->assign(array('sid' => $this->sid, 'list' => $data, 'type' => $this->type, 'total' => $param['total'], 'pages' => $this->get_pagination(dr_url('poster2/index', $param), $param['total'])));
     $this->template->display('poster2_index.html');
 }
Beispiel #6
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);
 }
Beispiel #7
0
 /**
  * 禁用/可用
  */
 public function disabled()
 {
     if ($this->is_auth('admin/application/config')) {
         $id = (int) $this->input->get('id');
         $_data = $this->db->select('disabled')->where('id', $id)->limit(1)->get('application')->row_array();
         $this->db->where('id', $id)->update('application', array('disabled' => $_data['disabled'] == 1 ? 0 : 1));
         $this->clear_cache('app');
     }
     exit(dr_json(1, lang('014')));
 }
Beispiel #8
0
 /**
  * 复制
  */
 public function copy()
 {
     $id = (int) $this->input->get('id');
     $data = $this->db->where('id', $id)->limit(1)->get('urlrule')->row_array();
     if ($data) {
         $this->db->insert('urlrule', array('type' => $data['type'], 'name' => $data['name'] . '_copy', 'value' => $data['value']));
         $this->cache(1);
     }
     exit(dr_json(1, lang('000')));
 }
Beispiel #9
0
 /**
  * 会员权限划分
  */
 public function permission()
 {
     $dir = trim(str_replace('.', '', $this->input->get('dir')), '/');
     $file = $this->path . $dir . '/rule.php';
     if (IS_POST) {
         file_put_contents($file, dr_array2string($this->input->post('data')));
         echo dr_json(1, lang('000'));
         exit;
     }
     $this->template->assign('data', is_file($file) ? dr_string2array(file_get_contents($file)) : array());
     $this->template->assign('space', $dir);
     $this->template->display('space_permission.html');
 }
 /**
  * 禁用/可用
  */
 public function disabled()
 {
     if ($this->is_auth('admin/application/config')) {
         $id = (int) $this->input->get('id');
         $data = $this->db->where('id', $id)->get('application')->row_array();
         $value = $data['disabled'] == 1 ? 0 : 1;
         $this->db->where('id', $id)->update('application', array('disabled' => $value));
         $this->clear_cache('app');
         $this->system_log(($value ? '禁用' : '启用') . '应用【' . $data['dirname'] . '】');
         // 记录日志
     }
     exit(dr_json(1, lang('014')));
 }
Beispiel #11
0
 /**
  * 充值
  */
 public function add()
 {
     if (IS_POST) {
         $data = $this->input->post('data');
         $value = intval($data['value']);
         if (!$value) {
             exit(dr_json(0, lang('131'), 'value'));
         }
         $this->member_model->update_score(0, $this->userinfo['uid'], $value, '', $data['note']);
         $this->member_model->add_notice($this->userinfo['uid'], 1, dr_lang('m-080', SITE_EXPERIENCE, $value, $this->member['username']));
         exit(dr_json(1, lang('000')));
     }
     $this->template->display('score_add.html');
 }
Beispiel #12
0
 /**
  * 添加地址
  */
 public function add()
 {
     if (IS_POST) {
         $data = $this->validate_filter($this->address_model->get_address_field());
         if (isset($data['error'])) {
             if (IS_AJAX) {
                 exit(dr_json(0, $data['msg'], $data['error']));
             }
             $error = $data['error'];
         } else {
             $this->address_model->add_address($data[1]);
             $this->member_msg(lang('000'), dr_url('address/index'), 1);
         }
     }
     $this->template->assign(array('data' => $data, 'result_error' => $error));
     $this->template->display('address_add.html');
 }
Beispiel #13
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');
 }
Beispiel #14
0
 /**
  * 管理
  */
 public function index()
 {
     if (IS_POST) {
         $ids = $this->input->post('ids', TRUE);
         if (!$ids) {
             exit(dr_json(0, lang('013')));
         }
         if (!$this->is_auth('admin/urlrule/del')) {
             exit(dr_json(0, lang('160')));
         }
         $this->db->where_in('id', $ids)->delete('urlrule');
         $this->cache(1);
         exit(dr_json(1, lang('000')));
     }
     $this->template->assign(array('list' => $this->db->get('urlrule')->result_array(), 'color' => array(0 => 'green', 1 => 'blue')));
     $this->template->display('urlrule_index.html');
 }
Beispiel #15
0
 /**
  * 修改
  */
 public function edit()
 {
     $id = (int) $this->input->get('id');
     $data = $this->link->where('id', $id)->limit(1)->get($this->tablename)->row_array();
     if (!$data) {
         exit(lang('019'));
     }
     if (IS_POST) {
         $data = $this->validate_filter($this->field);
         if (isset($data['error'])) {
             exit(dr_json(0, $data['msg'], $data['error']));
         }
         $this->link->where('id', (int) $id)->update($this->tablename, $data[1]);
         $this->cache(1);
         exit(dr_json(1, lang('000'), ''));
     }
     $this->template->assign(array('data' => $data, 'field' => $this->field));
     $this->template->display('block_add.html');
 }
 /**
  * 管理
  */
 public function index()
 {
     if (IS_POST) {
         $ids = $this->input->post('ids', TRUE);
         if (!$ids) {
             exit(dr_json(0, lang('013')));
         }
         if (!$this->is_auth('admin/attachment2/del')) {
             exit(dr_json(0, lang('160')));
         }
         $this->db->where_in('id', $ids)->delete(SITE_ID . '_remote');
         $this->cache(1);
         $this->system_log('删除远程附件配置【#' . @implode(',', $ids) . '】');
         // 记录日志
         exit(dr_json(1, lang('000')));
     }
     $this->template->assign(array('list' => $this->db->get(SITE_ID . '_remote')->result_array()));
     $this->template->display('attachment2_index.html');
 }
Beispiel #17
0
 /**
  * 修改
  */
 public function edit()
 {
     $id = (int) $this->input->get('id');
     $data = $this->db->where('id', $id)->limit(1)->get('downservers')->row_array();
     if (!$data) {
         $this->admin_msg(lang('019'));
     }
     if (IS_POST) {
         $data = $this->input->post('data');
         if (!$data['name'] || !$data['server']) {
             exit(dr_json(0, lang('342'), 'name'));
         }
         $data['displayorder'] = (int) $data['displayorder'];
         $this->db->where('id', $id)->update('downservers', $data);
         $this->cache(1);
         exit(dr_json(1, lang('000')));
     }
     $this->template->assign(array('data' => $data));
     $this->template->display('downservers_add.html');
 }
Beispiel #18
0
 /**
  * 发送
  */
 public function ajaxsend()
 {
     $data = $this->input->post('data', true);
     if (strlen($data['content']) > 150) {
         exit(dr_json(0, '短信数量太长,保持在70个字内'));
     }
     $mobile = $data['mobile'];
     if ($data['mobiles'] && !$data['mobile']) {
         $mobile = str_replace(array(PHP_EOL, chr(13), chr(10)), ',', $data['mobiles']);
         $mobile = str_replace(',,', ',', $mobile);
         $mobile = trim($mobile, ',');
     }
     if (substr_count($mobile, ',') > 40) {
         exit(dr_json(0, '手机号码太多,不能超过40个'));
     }
     $result = fn_sendsms($mobile, $data['content']);
     if ($result === FALSE) {
         exit(dr_json(0, '验证发送失败'));
     } else {
         exit(dr_json($result['status'], $result['msg']));
     }
 }
 /**
  * 会员权限划分
  */
 public function permission()
 {
     $dir = trim(str_replace('.', '', $this->input->get('dir')), '/');
     $file = $this->path . $dir . '/rule.php';
     if (IS_POST) {
         file_put_contents($file, dr_array2string($this->input->post('data')));
         $this->system_log('会员空间模板的权限划分');
         // 记录日志
         echo dr_json(1, lang('000'));
         exit;
     }
     $data = is_file($file) ? dr_string2array(file_get_contents($file)) : array();
     if ($data && !isset($data[1]['price'])) {
         $temp = array();
         foreach ($data as $i => $t) {
             $temp[$i]['use'] = 0;
             $temp[$i]['price'] = $t;
         }
         $data = $temp;
     }
     $this->template->assign('data', $data);
     $this->template->assign('space', $dir);
     $this->template->display('space_permission.html');
 }
Beispiel #20
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');
 }
 /**
  * 删除
  */
 public function del()
 {
     // 作者判断
     if ($this->content['uid'] != $this->uid) {
         $this->member_msg(lang('mod-05'));
     }
     // 删除权限
     if (!$this->catrule['del']) {
         $this->member_msg(lang('160'));
     }
     $id = (int) $this->input->post('id');
     if ($id) {
         $data = $this->link->select('tableid,id')->where('id', $id)->get($this->content_model->prefix . '_extend')->row_array();
         if ($data) {
             $this->content_model->delete_extend_for_id($id, $this->content['id'], $data['tableid']);
         }
     }
     exit(dr_json(1, lang('000')));
 }
 /**
  * 修改审核
  */
 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');
 }
Beispiel #23
0
 /**
  * 管理
  */
 public function index()
 {
     if (IS_AJAX && $this->input->post('action')) {
         $ids = $this->input->post('ids');
         if ($this->input->post('action') == 'delete') {
             if ($ids) {
                 foreach ($ids as $id) {
                     $data = $this->db->where('id', (int) $id)->select('uid')->limit(1)->get($this->space_content_model->tablename)->row_array();
                     if ($data) {
                         $this->db->where('id', (int) $id)->delete($this->space_content_model->tablename);
                         $this->load->model('attachment_model');
                         $this->attachment_model->delete_for_table($this->space_content_model->tablename . '-' . $id);
                         // 删除附件
                         $member = $this->member_model->get_member($data['uid']);
                         $markrule = $member ? $member['mark'] : 0;
                         $experience = (int) $this->model['setting'][$markrule]['experience'];
                         $score = (int) $this->model['setting'][$markrule]['score'];
                         // 积分处理
                         if ($experience > 0) {
                             $this->member_model->update_score(0, $data['uid'], -$experience, '', "delete");
                         }
                         // 虚拟币处理
                         if ($score > 0) {
                             $this->member_model->update_score(1, $data['uid'], -$score, '', "delete");
                         }
                     }
                 }
             }
             exit(dr_json(1, lang('000')));
         } else {
             if ($ids) {
                 $status = (int) $this->input->post('status');
                 foreach ($ids as $id) {
                     $data = $this->db->where('id', (int) $id)->select('uid')->limit(1)->get($this->space_content_model->tablename)->row_array();
                     $this->db->where('id', (int) $id)->update($this->space_content_model->tablename, array('status' => $status));
                     if ($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'];
                         $mark = $this->space_content_model->tablename . '-' . $id;
                         // 积分处理
                         if ($experience) {
                             $this->member_model->update_score(0, $data['uid'], $experience, $mark, "add", 1);
                         }
                         // 虚拟币处理
                         if ($score) {
                             $this->member_model->update_score(1, $data['uid'], $score, $mark, "add", 1);
                         }
                     }
                 }
             }
             exit(dr_json(1, lang('000')));
         }
     }
     // 重置页数和统计
     if (IS_POST) {
         $_GET['page'] = $_GET['total'] = 0;
     }
     // 根据参数筛选结果
     $param = array();
     if ($this->input->get('search')) {
         $param['search'] = 1;
     }
     // 数据库中分页查询
     list($data, $param) = $this->space_content_model->limit_page($param, max((int) $_GET['page'], 1), (int) $_GET['total']);
     // 搜索参数
     if ($this->input->get('search')) {
         $_param = $this->cache->file->get($this->space_content_model->cache_file);
     } else {
         $_param = $this->input->post('data');
     }
     $_param = $_param ? $param + $_param : $param;
     $param['mid'] = $this->mid;
     $this->template->assign(array('list' => $data, 'param' => $_param, 'field' => $this->model['field'], 'pages' => $this->get_pagination(dr_url('member/content/index', $param), $param['total'])));
     $this->template->display(is_file(FCPATH . 'member/templates/admin/content_' . $this->mid . '.html') ? 'content_' . $this->mid . '.html' : 'content_index.html');
 }
Beispiel #24
0
 /**
  * 会员提示消息显示
  *
  * @param	string	$msg	提示信息
  * @param	string	$url	转向地址
  * @param	int		$mark	标示符号1:成功;0:失败;2:等待
  * @param	int		$time	等待时间
  * @param	bool	$ajax	是否ajax提交显示
  * @return  void
  */
 public function member_msg($msg, $url = '', $mark = 0, $time = 1, $ajax = FALSE)
 {
     // 当指定为ajax提交或者系统提交状态为ajax则返回json数据
     if ($ajax || IS_AJAX) {
         exit(dr_json($mark ? 1 : 0, $msg, $url));
     } else {
         $this->template->assign(array('msg' => $msg, 'url' => $url, 'time' => $time, 'mark' => $mark, 'meta_name' => lang('m-030')));
         $this->template->display('msg.html', 'member');
     }
     exit;
 }
Beispiel #25
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');
 }
Beispiel #26
0
 /**
  * 管理列表
  */
 public function index()
 {
     if (IS_POST && $this->input->post('ids')) {
         $table = SITE_ID . '_navigator';
         if ($this->input->post('action') == 'del') {
             // 删除
             $this->navigator_model->delete($this->input->post('ids'));
             $this->cache(1);
         } elseif ($this->input->post('action') == 'order' && $this->is_auth('navigator/edit')) {
             // 修改
             $_ids = $this->input->post('ids');
             $_data = $this->input->post('data');
             foreach ($_ids as $id) {
                 $this->db->where('id', (int) $id)->update($table, $_data[$id]);
             }
             $this->cache(1);
             unset($_ids, $_data);
         }
         exit(dr_json(1, lang('000')));
     }
     $this->load->library('dtree');
     $this->dtree->icon = array('&nbsp;&nbsp;&nbsp;│ ', '&nbsp;&nbsp;&nbsp;├─ ', '&nbsp;&nbsp;&nbsp;└─ ');
     $this->dtree->nbsp = '&nbsp;&nbsp;&nbsp;';
     $tree = array();
     $data = $this->navigator_model->get_data($this->type);
     if ($data) {
         foreach ($data as $t) {
             $add = dr_url('navigator/add', array('pid' => $t['id'], 'type' => $this->type));
             $edit = dr_url('navigator/edit', array('id' => $t['id'], 'type' => $this->type));
             $t['option'] = '';
             if ($this->is_auth('admin/navigator/add')) {
                 $t['option'] .= '<a class="add" style="margin-top:3px;" title="' . lang('add') . '" href="' . $add . '"></a>';
             }
             if ($this->is_auth('admin/navigator/edit')) {
                 $t['option'] .= '&nbsp;&nbsp;&nbsp;<a title="' . lang('edit') . '" href="' . $edit . '">' . lang('edit') . '</a>';
             }
             $t['option'] .= '&nbsp;&nbsp;<a title="' . lang('go') . '" href="' . $t['url'] . '" target="_blank">' . lang('go') . '</a>';
             if (strpos($t['mark'], 'page') === 0) {
                 //1
                 $t['ntype'] = '<font color=blue>' . lang('128') . '</font>';
             } elseif (strpos($t['mark'], 'module') === 0) {
                 //2
                 list($a, $dir, $catid) = explode('-', $t['mark']);
                 $t['ntype'] = '<font color=green>' . lang('html-010') . '</font>';
                 if ($catid) {
                     $t['option'] .= '&nbsp;&nbsp;<a href="' . dr_url($dir . '/category/add', array('id' => $catid)) . '">' . lang('355') . '</a>';
                     $t['option'] .= '&nbsp;&nbsp;<a href="' . dr_url($dir . '/category/edit', array('id' => $catid)) . '">' . lang('356') . '</a>';
                 }
             } else {
                 //0
                 $t['ntype'] = lang('198');
             }
             $tree[$t['id']] = $t;
         }
     }
     $str = "<tr class='\$class'>";
     $str .= "<td align='right'><input name='ids[]' type='checkbox' class='dr_select' value='\$id' />&nbsp;</td>";
     $str .= "<td align='left'><input class='input-text displayorder' type='text' name='data[\$id][displayorder]' value='\$displayorder' /></td>";
     $str .= "<td align='left'>\$id</td>";
     if ($this->is_auth('admin/navigator/edit')) {
         $str .= "<td>\$spacer<a href='" . dr_url(APP_DIR . '/navigator/edit') . "&id=\$id&type=" . $this->type . "'>\$name</a>  \$parent</td>";
     } else {
         $str .= "<td>\$spacer\$name  \$parent</td>";
     }
     $str .= "<td align='center'>\$ntype</td>";
     $str .= "<td align='center'>";
     if ($this->is_auth('admin/navigator/edit')) {
         $str .= "<a href='" . dr_url('navigator/target') . "&id=\$id'><img src='" . SITE_URL . "omooo/statics/images/\$target.gif' /></a>";
     } else {
         $str .= "<img src='" . SITE_URL . "omooo/statics/images/\$target.gif' />";
     }
     $str .= "</td>";
     $str .= "<td align='center'>";
     if ($this->is_auth('admin/navigator/edit')) {
         $str .= "<a href='" . dr_url('navigator/show') . "&id=\$id'><img src='" . SITE_URL . "omooo/statics/images/\$show.gif' /></a>";
     } else {
         $str .= "<img src='" . SITE_URL . "omooo/statics/images/\$show.gif' />";
     }
     $str .= "</td>";
     $str .= "<td align='left'>\$option</td>";
     $str .= "</tr>";
     $this->dtree->init($tree);
     $this->template->assign(array('type' => $this->type, 'list' => $this->dtree->get_tree(0, $str)));
     $this->template->display('navigator_index.html');
 }
Beispiel #27
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');
 }
 /**
  * 草稿箱管理
  */
 public function draft()
 {
     $table = $this->content_model->prefix . '_draft';
     if (IS_POST) {
         $ids = $this->input->post('ids');
         if (!$ids) {
             exit(dr_json(0, lang('013')));
         }
         $this->load->model('attachment_model');
         foreach ($ids as $id) {
             // 删除草稿记录
             if ($this->link->where('id', $id)->where('uid', $this->uid)->get($table)->row_array()) {
                 $this->link->where('id', $id)->delete($table);
                 // 删除表对应的附件
                 $this->attachment_model->delete_for_table($table . '-' . $id);
             }
         }
         $this->system_log('删除站点【#' . SITE_ID . '】模块【' . APP_DIR . '】草稿内容【#' . @implode(',', $ids) . '】');
         // 记录日志
         exit(dr_json(1, lang('000')));
         break;
     }
     $page = max(1, (int) $this->input->get('page'));
     $total = $_GET['total'] ? intval($_GET['total']) : $this->link->where('uid', $this->uid)->count_all_results($table);
     if ($total) {
         $result = $this->link->where('uid', $this->uid)->limit(SITE_ADMIN_PAGESIZE, SITE_ADMIN_PAGESIZE * ($page - 1))->order_by('inputtime DESC, id DESC')->get($table)->result_array();
     } else {
         $result = array();
     }
     $this->template->assign(array('menu' => $this->get_menu(array(lang('334') => APP_DIR . '/admin/home/draft', lang('mod-02') => APP_DIR . '/admin/home/add')), 'list' => $result, 'total' => $total, 'pages' => $this->get_pagination(dr_url(APP_DIR . '/home/draft'), $total)));
     $this->template->display('content_draft.html');
 }
 /**
  * 回调方法
  */
 protected function call_msg($msg, $code = 0)
 {
     $url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
     if (IS_AJAX) {
         exit(dr_json($code, $msg, $url));
         // AJAX请求时返回json格式
     } else {
         if ($code) {
             $this->msg($msg, $url, 1);
             // 成功
         } else {
             $this->msg($msg);
             // 错误
         }
     }
 }
Beispiel #30
0
 /**
  * 删除
  */
 protected function admin_del()
 {
     $this->link->where('id', (int) $this->input->get('id'))->delete($this->tag_model->tablename);
     exit(dr_json(1, lang('000')));
 }